【发布时间】:2014-03-06 07:18:02
【问题描述】:
我正在努力解决 . 我想在画布的右端绘制一个条,然后在下一帧上,将条向左移动一个“位置”,并在右端绘制第二个条。然后在第三帧上,将两个条向左移动一个位置并绘制第三个条,依此类推...
[ | | | |1], [ | | |1|2],[ | |1|2|3]
它可以工作,但是像这样我必须为每个条写 context.strokeRect() 行...
context.strokeStyle = "black";
context.strokeRect(490, 100, 8, width[i]);
context.strokeRect(480, 100, 8, width[i-1]);
context.strokeRect(470, 100, 8, width[i-2]);
context.stroke();
这不是最好的方法..?
【问题讨论】: