From f62a1e17c935193be2f6244e871aece9eea43ed8 Mon Sep 17 00:00:00 2001 From: Fabian Zills Date: Sat, 9 Nov 2024 19:48:00 +0100 Subject: [PATCH 1/2] allow for flexible playback step size --- app/src/App.tsx | 1 + app/src/components/particles.tsx | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/App.tsx b/app/src/App.tsx index 75e568afe..1f7fede92 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -685,6 +685,7 @@ export default function App() { loop={roomConfig["scene"]["animation_loop"]} length={length} selectedFrames={selectedFrames} + stepSize={1} /> void; selectedFrames: IndicesState; + stepSize: number; } export const Player = ({ @@ -44,7 +45,9 @@ export const Player = ({ loop, togglePlaying: setPlaying, selectedFrames, + stepSize, }: PlayerProps) => { + useFrame(({ clock }) => { const a = clock.getElapsedTime(); if (a > 1 / fps) { @@ -62,7 +65,7 @@ export const Player = ({ } else { if (selectedFrames.indices.size > 0 && selectedFrames.active) { const nextFrame = Array.from(selectedFrames.indices).find( - (frame) => frame > step, + (frame) => frame >= step + stepSize, ); if (nextFrame) { setStep(nextFrame); @@ -70,7 +73,7 @@ export const Player = ({ setStep(Math.min(...selectedFrames.indices)); } } else { - setStep(step + 1); + setStep(step + stepSize); } } } From aa541643a4731c0dd696031defdd8460cb3bad2a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 18:48:17 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- app/src/components/particles.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/components/particles.tsx b/app/src/components/particles.tsx index faf359e1e..0ae8073e0 100644 --- a/app/src/components/particles.tsx +++ b/app/src/components/particles.tsx @@ -47,7 +47,6 @@ export const Player = ({ selectedFrames, stepSize, }: PlayerProps) => { - useFrame(({ clock }) => { const a = clock.getElapsedTime(); if (a > 1 / fps) {