(lastTime)
| 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({ |
no test coverage detected