blob: 7e7e40a918c02957bcc92d5db641db0ea461c5a3 [file] [log] [blame]
commit-bot@chromium.org48d94b8c2013-12-16 18:24:51 +00001/**
2 * @fileoverview Sample onDraw script for use with SkV8Example.
3 */
4var onDraw = function(){
5 var tick = 0;
jcgregorio5e44b002014-10-27 10:27:01 -07006 var p = new Path2D();
7 p.rect(0, 0, 200, 200);
8
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +00009 function f(context) {
commit-bot@chromium.org0fc0dea2013-12-18 04:45:37 +000010 tick += 0.1;
jcgregorio5e44b002014-10-27 10:27:01 -070011
12 context.translate(context.width/2, context.height/2);
13 context.rotate(tick);
14 context.drawPath(p);
commit-bot@chromium.org48d94b8c2013-12-16 18:24:51 +000015 };
16 return f;
17}();
commit-bot@chromium.org0fc0dea2013-12-18 04:45:37 +000018
19function onTimeout() {
20 inval();
commit-bot@chromium.org872796b2013-12-20 15:56:52 +000021 print(setTimeout(onTimeout, 33));
commit-bot@chromium.org0fc0dea2013-12-18 04:45:37 +000022}
23
24setTimeout(onTimeout, 33);