2013-12-16 18:24:51 +00:00
|
|
|
/**
|
|
|
|
* @fileoverview Sample onDraw script for use with SkV8Example.
|
|
|
|
*/
|
|
|
|
var onDraw = function(){
|
2014-10-29 12:33:27 +00:00
|
|
|
var ticks = 0;
|
|
|
|
var b = new Path2DBuilder();
|
|
|
|
b.rect(0, 0, 200, 200);
|
|
|
|
var p = b.finalize();
|
2014-10-27 17:27:01 +00:00
|
|
|
|
2014-01-06 18:17:24 +00:00
|
|
|
function f(context) {
|
2014-10-29 12:33:27 +00:00
|
|
|
ticks += 1;
|
2014-10-27 17:27:01 +00:00
|
|
|
|
|
|
|
context.translate(context.width/2, context.height/2);
|
2014-10-29 12:33:27 +00:00
|
|
|
context.rotate(ticks/10);
|
2014-10-27 17:27:01 +00:00
|
|
|
context.drawPath(p);
|
2014-10-29 12:33:27 +00:00
|
|
|
|
|
|
|
inval();
|
2013-12-16 18:24:51 +00:00
|
|
|
};
|
2014-10-29 12:33:27 +00:00
|
|
|
|
|
|
|
function onTimeout() {
|
|
|
|
console.log(ticks);
|
|
|
|
ticks = 0;
|
|
|
|
setTimeout(onTimeout, 1000);
|
|
|
|
}
|
|
|
|
setTimeout(onTimeout, 1000);
|
|
|
|
|
2013-12-16 18:24:51 +00:00
|
|
|
return f;
|
|
|
|
}();
|
2013-12-18 04:45:37 +00:00
|
|
|
|