From: Ian Jackson Date: Sat, 16 Apr 2022 11:36:14 +0000 (+0100) Subject: dice js: Break out die_request_animation X-Git-Tag: otter-1.1.0~531 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=823f405880adce5879b724e10b903ae24cb8a8a4;p=otter.git dice js: Break out die_request_animation We're going to want to re-request animiation in the frame renderer, obviously. Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 464387e0..a69bbab1 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -2268,10 +2268,14 @@ type DieSpecialRendering = SpecialRendering & { special_renderings['Die'] = function(piece: PieceId, p: PieceInfo, s: DieSpecialRendering) { s.stop = die_rendering_stop as any; + die_request_animation(piece, p, s); +} as any; +function die_request_animation(piece: PieceId, p: PieceInfo, + s: DieSpecialRendering) { s.anim_id = window.requestAnimationFrame( function(ts) { die_render_frame(piece, p, s, ts) } ); -} as any; +} function die_render_frame(piece: PieceId, p: PieceInfo, s: DieSpecialRendering, ts: DOMHighResTimeStamp) { s.anim_id = null;