| OLD | NEW |
| 1 /** | 1 /** |
| 2 * @fileoverview Sample onDraw script for use with SkV8Example. | 2 * @fileoverview Sample onDraw script for use with SkV8Example. |
| 3 */ | 3 */ |
| 4 var onDraw = function(){ | 4 var onDraw = function(){ |
| 5 var tick = 0; | 5 var tick = 0; |
| 6 function f(canvas) { | 6 function f(canvas) { |
| 7 tick += 0.01; | 7 tick += 0.1; |
| 8 canvas.fillStyle = '#0000ff'; | 8 canvas.fillStyle = '#0000ff'; |
| 9 canvas.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100); | 9 canvas.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100); |
| 10 canvas.inval(); | |
| 11 }; | 10 }; |
| 12 return f; | 11 return f; |
| 13 }(); | 12 }(); |
| 13 |
| 14 function onTimeout() { |
| 15 inval(); |
| 16 print("Got a timeout!"); |
| 17 setTimeout(onTimeout, 33); |
| 18 } |
| 19 |
| 20 setTimeout(onTimeout, 33); |
| OLD | NEW |