【发布时间】:2015-03-24 10:57:42
【问题描述】:
这里有画布,可以在画布上画线……每 300 毫秒画一条线,但对眼睛来说太难了……
代码:
var test = [{"X":300,"Y":200}];
var set_time;
var m = 0;
var add_array = function(){
ctx.clearRect ( 0 , 0 , canvas.width, canvas.height );
if(m < pts.length){
var q = pts[m].X;
var e = pts[m].Y;
console.log(test);
test.push({"X":q,"Y":e});
mimicSvg(test,1);
m++;
set_time = setTimeout(add_array,300);//it call itself again and again until m is more than the length of the array'
}else{
clearTimeout(set_time);
}
};
set_time = setTimeout(add_array,300);
有什么方法可以使动画过渡顺利进行吗? 有什么方法可以让这个动画更好?如何进行过渡?
【问题讨论】:
标签: html animation canvas polyline smoothing