aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/SkV8Example/speed.js
blob: 5b0f0013546d18c3e92a1a3e435e21bcdff4ef93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * @fileoverview Sample onDraw script for use with SkV8Example.
 */
var onDraw = function(){
  var tick = 0;
  function f(canvas) {
    tick += 0.1;
    canvas.fillStyle = '#0000ff';
    canvas.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100);
    inval();
  };

  function onTimeout() {
      print(tick*10, " FPS");
      setTimeout(onTimeout, 1000);
      tick=0;
  }

  setTimeout(onTimeout, 1000);

  return f;
}();