【发布时间】:2025-11-28 22:15:01
【问题描述】:
我绘制的红色矩形应该会顺利消失。 如您所见here,它有效,但并没有完全消失。为什么?
(function init() {
var canvas = document.getElementById('canvas'), ctx;
if (!canvas.getContext) return;
ctx = canvas.getContext('2d');
ctx.fillStyle = "red";
ctx.fillRect(0,0,canvas.width,canvas.height);
ctx.fill();
ctx.fillStyle = "rgba(255,255,255,0.1)";
setInterval(function() {
ctx.fillRect(0,0,canvas.width,canvas.height);
ctx.fill();
}, 100);
}());
它还应该同时处理许多不同的颜色和 alpha 值。
谢谢你:D
【问题讨论】:
标签: javascript canvas shader opacity alpha