Index: experimental/SkV8Example/js/sample.js |
diff --git a/experimental/SkV8Example/js/sample.js b/experimental/SkV8Example/js/sample.js |
index 7e7e40a918c02957bcc92d5db641db0ea461c5a3..f04da337e2a4d52880f4668770bec9d010a61714 100644 |
--- a/experimental/SkV8Example/js/sample.js |
+++ b/experimental/SkV8Example/js/sample.js |
@@ -2,23 +2,28 @@ |
* @fileoverview Sample onDraw script for use with SkV8Example. |
*/ |
var onDraw = function(){ |
- var tick = 0; |
- var p = new Path2D(); |
- p.rect(0, 0, 200, 200); |
+ var ticks = 0; |
+ var b = new Path2DBuilder(); |
+ b.rect(0, 0, 200, 200); |
+ var p = b.finalize(); |
function f(context) { |
- tick += 0.1; |
+ ticks += 1; |
context.translate(context.width/2, context.height/2); |
- context.rotate(tick); |
+ context.rotate(ticks/10); |
context.drawPath(p); |
+ |
+ inval(); |
}; |
+ |
+ function onTimeout() { |
+ console.log(ticks); |
+ ticks = 0; |
+ setTimeout(onTimeout, 1000); |
+ } |
+ setTimeout(onTimeout, 1000); |
+ |
return f; |
}(); |
-function onTimeout() { |
- inval(); |
- print(setTimeout(onTimeout, 33)); |
-} |
- |
-setTimeout(onTimeout, 33); |