commit-bot@chromium.org | 48d94b8c | 2013-12-16 18:24:51 +0000 | [diff] [blame] | 1 | /** |
| 2 | * @fileoverview Sample onDraw script for use with SkV8Example. |
| 3 | */ |
| 4 | var onDraw = function(){ |
| 5 | var tick = 0; |
commit-bot@chromium.org | c8d7328 | 2014-01-06 18:17:24 +0000 | [diff] [blame^] | 6 | function f(context) { |
commit-bot@chromium.org | 0fc0dea | 2013-12-18 04:45:37 +0000 | [diff] [blame] | 7 | tick += 0.1; |
commit-bot@chromium.org | c8d7328 | 2014-01-06 18:17:24 +0000 | [diff] [blame^] | 8 | context.fillStyle = '#0000ff'; |
| 9 | context.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100); |
commit-bot@chromium.org | 48d94b8c | 2013-12-16 18:24:51 +0000 | [diff] [blame] | 10 | }; |
| 11 | return f; |
| 12 | }(); |
commit-bot@chromium.org | 0fc0dea | 2013-12-18 04:45:37 +0000 | [diff] [blame] | 13 | |
| 14 | function onTimeout() { |
| 15 | inval(); |
commit-bot@chromium.org | 872796b | 2013-12-20 15:56:52 +0000 | [diff] [blame] | 16 | print(setTimeout(onTimeout, 33)); |
commit-bot@chromium.org | 0fc0dea | 2013-12-18 04:45:37 +0000 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | setTimeout(onTimeout, 33); |