Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: experimental/SkV8Example/js/sample.js

Issue 661033005: SkV8Sample: Now with Path2D and Path2DBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: path* Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ticks = 0;
6 var p = new Path2D(); 6 var b = new Path2DBuilder();
7 p.rect(0, 0, 200, 200); 7 b.rect(0, 0, 200, 200);
8 var p = b.finalize();
8 9
9 function f(context) { 10 function f(context) {
10 tick += 0.1; 11 ticks += 1;
11 12
12 context.translate(context.width/2, context.height/2); 13 context.translate(context.width/2, context.height/2);
13 context.rotate(tick); 14 context.rotate(ticks/10);
14 context.drawPath(p); 15 context.drawPath(p);
16
17 inval();
15 }; 18 };
19
20 function onTimeout() {
21 console.log(ticks);
22 ticks = 0;
23 setTimeout(onTimeout, 1000);
24 }
25 setTimeout(onTimeout, 1000);
26
16 return f; 27 return f;
17 }(); 28 }();
18 29
19 function onTimeout() {
20 inval();
21 print(setTimeout(onTimeout, 33));
22 }
23
24 setTimeout(onTimeout, 33);
OLDNEW
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698