Skip to content
Snippets Groups Projects
Unverified Commit f2e26f91 authored by David Sehnal's avatar David Sehnal Committed by GitHub
Browse files

Merge pull request #647 from dwilliams-nobias/animation-once-stops

Animation "once" fails to stop for many frames under certain conditions
parents 65310e52 e2cdc45b
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased]
- Fix 'once' for animations of systems with many frames
- Better guard against issue (black fringes) with bumpiness in impostors
## [v3.26.0] - 2022-12-04
......
This diff is collapsed.
......@@ -93,7 +93,8 @@
"Adam Midlik <midlik@gmail.com>",
"Koya Sakuma <koya.sakuma.work@gmail.com>",
"Gianluca Tomasello <giagitom@gmail.com>",
"Jason Pattle <jpattle@exscientia.co.uk>"
"Jason Pattle <jpattle@exscientia.co.uk>",
"David Williams <dwilliams@nobiastx.com>"
],
"license": "MIT",
"devDependencies": {
......
......@@ -124,6 +124,11 @@ export const AnimateModelIndex = PluginStateAnimation.create({
? params.duration.params.durationInS * 1000
: Math.ceil(1000 * traj.data.frameCount / params.duration.params.targetFps);
if (params.mode.name === 'once' && t.current >= durationInMs) {
isEnd = true;
return { modelIndex: traj.data.frameCount-1 };
}
let phase: number = (t.current % durationInMs) / durationInMs;
if (params.mode.name === 'loop') {
if (params.mode.params.direction === 'backward') {
......@@ -135,7 +140,6 @@ export const AnimateModelIndex = PluginStateAnimation.create({
}
const modelIndex = Math.min(Math.floor(traj.data.frameCount * phase), traj.data.frameCount - 1);
isEnd = isEnd || modelIndex === traj.data.frameCount - 1;
return { modelIndex };
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment