1 /** 2 * @fileoverview Sample onDraw script for use with SkV8Example. 3 */ 4 var onDraw = function(){ 5 var ticks = 0; 6 var b = new Path2DBuilder(); 7 b.rect(0, 0, 200, 200); 8 var p = b.finalize(); 9 10 function f(context) { 11 ticks += 1; 12 13 context.translate(context.width/2, context.height/2); 14 context.rotate(ticks/10); 15 context.drawPath(p); 16 17 inval(); 18 }; 19 20 function onTimeout() { 21 console.log(ticks); 22 ticks = 0; 23 setTimeout(onTimeout, 1000); 24 } 25 setTimeout(onTimeout, 1000); 26 27 return f; 28 }(); 29 30