From 2df5a153b7240c399370fb472e5e89f84ec48d2f Mon Sep 17 00:00:00 2001 From: s-ol Date: Tue, 23 Oct 2018 01:29:18 +1100 Subject: finish koch --- lib/canvasapp.client.moon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3