1
我是新来的编码和Javascript,我有点迷路。我正尝试创建多个线条,在刷新时进行动画处理。像这样...简单,我如何在画布中使用数组来创建多行动画?
if (min < max) {
context.beginPath();
if (direction) {
context.moveTo(topMinX, topMinY);
topMinX = topMinX + 2;
context.lineTo(topMinX, topMaxY);
} else {
context.moveTo(topMinX, topMinY);
topMinY = topMinY + 2;
context.lineTo(topMaxX, topMinY);
}
context.lineWidth = 4;
context.stroke();
}
}
但具有多行下去y轴间隔开约20个像素分开。
我的老师建议用数组制作多行,但我完全失去了。
您可以使用x,y值的数组,并在for循环中使用lineTo。 – slamborne 2013-03-03 23:20:33