MCPcopy
hub / github.com/ericdrowell/KineticJS / animate

Function animate

test/performance/common/random-squares.js:58–80  ·  view source on GitHub ↗
(lastTime)

Source from the content-addressed store, hash-verified

56 });
57
58 function animate(lastTime){
59 stats.begin();
60 // update
61 var date = new Date();
62 var time = date.getTime();
63 var timeDiff = time - lastTime;
64 var period = timeDiff/1000; //times per second, our period
65
66 for (var i = 0; i < circles.length; i++) {
67 var x = Math.round(Math.random() * width);
68 var y = Math.round(Math.random() * height);
69
70 circles[i].setPosition({x: x, y: y});
71
72 }
73 lastTime = time;
74
75 circlesLayer.draw();
76 stats.end();
77 requestAnimFrame(function(){
78 animate(lastTime);
79 });
80 }
81
82 function make_shape(color) {
83 return new Kinetic.Rect({

Callers 1

random-squares.jsFile · 0.70

Calls 1

requestAnimFrameFunction · 0.50

Tested by

no test coverage detected