diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-10-22 14:29:18 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-10-22 14:29:18 +0000 |
| commit | 2df5a153b7240c399370fb472e5e89f84ec48d2f (patch) | |
| tree | 9df11823c5a6ac1a5afb026e5bcb901927279d4c /lib | |
| parent | CanvasApp whammy.js webm exporting (diff) | |
| download | mmm-2df5a153b7240c399370fb472e5e89f84ec48d2f.tar.gz mmm-2df5a153b7240c399370fb472e5e89f84ec48d2f.zip | |
finish koch
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/canvasapp.client.moon | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/canvasapp.client.moon b/lib/canvasapp.client.moon index ed1cfb7..62aaceb 100644 --- a/lib/canvasapp.client.moon +++ b/lib/canvasapp.client.moon @@ -46,6 +46,10 @@ class CanvasApp update: (dt) => @time += dt + if @length and @time > @length + @time -= @length + true + render: (fps=60) => assert @length, 'cannot render CanvasApp without length set' @paused = true @@ -54,13 +58,13 @@ class CanvasApp writer = js.new window.Whammy.Video, fps doFrame = -> - @update 1/fps + done = @update 1/fps @ctx\resetTransform! @draw! writer\add @canvas - if @time >= @length + if done or @time >= @length blob = writer\compile! name = "#{@@__name}_#{fps}fps.webm" @node.lastChild\appendChild a name, download: name, href: window.URL\createObjectURL blob |
