diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cfd4c0ec..51801f4df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ We'll note all notable changes in this file, including bug fixes, enhancements, and all closed issues. Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http://semver.org/) format. +## 0.13.1 2024-11-30 + +### Fixed + +- Resume animations after unpausing +- Fixed $effect cycle in palette +- Fixed label ids on palette + ## 0.13.0 2024-11-02 ### Fixed diff --git a/package.json b/package.json index 47b81acca..f3c341a42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wordplay", - "version": "0.13", + "version": "0.13.1", "scripts": { "postinstall": "run-script-os", "postinstall:default": "svelte-kit sync && cp .env.template .env", @@ -101,4 +101,4 @@ "defaults", "not op_mini all" ] -} \ No newline at end of file +} diff --git a/src/components/output/StageView.svelte b/src/components/output/StageView.svelte index 596b8eaa8..d78ca1b86 100644 --- a/src/components/output/StageView.svelte +++ b/src/components/output/StageView.svelte @@ -189,29 +189,42 @@ } }); + function resetAnimator() { + if (animator !== undefined) animator.stop(); + // Make a new one. + animator = new Animator( + evaluator, + // When output exits, remove it from the map and triggering a render so that its removed from stage. + (name) => { + // Remember that we exited this name. + recentlyExited.add(name); + if (exiting.has(name)) exiting.delete(name); + }, + // When the animating poses or sequences on stage change, update the store + (nodes) => { + // Update the set of animated nodes. + if (interactive && animatingNodes) + animatingNodes.set(new Set(nodes)); + }, + ); + } + // When the evaluator changes, stop the animator and create a new animator for the new evaluator. $effect(() => { evaluator; // Previous scene? Stop it. - untrack(() => { - if (animator !== undefined) animator.stop(); - // Make a new one. - animator = new Animator( - evaluator, - // When output exits, remove it from the map and triggering a render so that its removed from stage. - (name) => { - // Remember that we exited this name. - recentlyExited.add(name); - if (exiting.has(name)) exiting.delete(name); - }, - // When the animating poses or sequences on stage change, update the store - (nodes) => { - // Update the set of animated nodes. - if (interactive && animatingNodes) - animatingNodes.set(new Set(nodes)); - }, - ); - }); + untrack(() => resetAnimator()); + }); + + // Stop or When the evaluator is playing but the animator is stopped, create a new animator. + $effect(() => { + if (animator) { + if ($evaluation.playing) { + if (animator.isStopped()) untrack(() => resetAnimator()); + } else { + animator.stop(); + } + } }); let context = $derived( diff --git a/src/output/Animator.ts b/src/output/Animator.ts index 52e17c562..958eb1cee 100644 --- a/src/output/Animator.ts +++ b/src/output/Animator.ts @@ -119,6 +119,10 @@ export default class Animator { this.physics = new Physics(evaluator); } + isStopped() { + return this.stopped; + } + /** * When any of the following inputs change, update the stage accordingly so that the * rendered screen reflects it.