使用PaperJS在一定时间后更改填充颜色

时间:2016-02-25 22:08:53

标签: paperjs

我试图在设定的时间后将fillcolor更改回原始颜色。

var point = new Point(20, 20);


var newPoint = Point.random() * view.size;
window.position = new Point(newPoint, newPoint);
var newPoint2 = Point.random() * view.size;
window2.position = new Point(newPoint2, newPoint2);
var newPoint3 = Point.random() * view.size;
window3.position = new Point(newPoint3, newPoint3);
var newPoint4 = Point.random() * view.size;
window4.position = new Point(newPoint4, newPoint4);
var newPoint5 = Point.random() * view.size;
window5.position = new Point(newPoint5, newPoint5);
var newPoint6 = Point.random() * view.size;
window6.position = new Point(newPoint6, newPoint6);
var newPoint7 = Point.random() * view.size;
window7.position = new Point(newPoint7, newPoint7);
var newPoint8 = Point.random() * view.size;
window8.position = new Point(newPoint8, newPoint8);
var newPoint9 = Point.random() * view.size;
window9.position = new Point(newPoint9, newPoint9);
var newPoint10 = Point.random() * view.size;
window10.position = new Point(newPoint10, newPoint10);


};


 };






  if(event.delta === 4){
window.fillColor = "coral";
window2.fillColor = "coral";
window3.fillColor = "coral";
window4.fillColor = "coral";
window5.fillColor = "coral";
window6.fillColor = "coral";
window7.fillColor = "coral";
window8.fillColor = "coral";
window9.fillColor = "coral";
window10.fillColor = "coral";
};   

我知道event.delta需要在某种事件处理程序中,但是如果我把它放在onFrame中,fillcolor会自动设置为珊瑚,即使它不应该直到时间已经消失了。也设置了它。 有任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我认为您正在寻找的是event.count

更新:Sketch