1c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org/** 2c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org * @fileoverview Sample onDraw script for use with SkV8Example. 3c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org */ 4c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.orgvar onDraw = function(){ 5c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org var tick = 0; 6c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org function f(canvas) { 7c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org tick += 0.1; 8c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org canvas.fillStyle = '#0000ff'; 9c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org canvas.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100); 10c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org inval(); 11c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org }; 12c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org 13c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org function onTimeout() { 14c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org print(tick*10, " FPS"); 15c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org setTimeout(onTimeout, 1000); 16c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org tick=0; 17c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org } 18c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org 19c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org setTimeout(onTimeout, 1000); 20c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org 21c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org return f; 22c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org}(); 23c8d732800e1a660fca6d2478fc24d6e6935ef8adcommit-bot@chromium.org 24