How to chain / queue animations programtically? #550
Replies: 3 comments 3 replies
-
i think the view should just reflect state, animation is intermediary, but it looks like the animation is influencing the view. the code also looks curiously big, i cant put my finger on it but my gut feeling is that this shouldnt be thousands and thousands of lines. |
Beta Was this translation helpful? Give feedback.
-
@hoestreich I am chaining animations together using a mutable array of arrays. const animations = {
current: [{name: 'DRAW', target: 'a1', state: 'IN PROGRESS'}], // currently drawing 1 card
queue: [
[{name: 'DRAW', target: 'a2', state: 'READY'}], // draw 1 card
[{name: 'DRAW', target: 'a3', state: 'READY'}, {name: 'DRAW', target: 'a4', state: 'READY'}] // then draw 2 cards at the same time
]
} I have a I then have a separate The benefit of Hopefully that helps. I can try and lift out an example from my code base if you need a more in-depth example :P |
Beta Was this translation helpful? Give feedback.
-
i successfully made animation chains in react-spring, that seemed to me relatively straight forward. i have also tried to do the same with lerping: https://codesandbox.io/s/r3f-basic-demo-bzbs8?file=/src/index.js but it's still a little buggy because it doesn't have a "start" point yet, it starts whereever the timestamp is at |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm not sure if this is the right place to discuss this issue... I already wrote a response on @aleclarson question regarding feedback on the new release canidate for react-spring v.9.0.0 (pmndrs/react-spring#985 (comment)) but did not receive a response yet.
I'm using react-three-fiber and react-spring to animate a rubics cube. The cube consists of 26 cube elements.
If one side of the cube should be rotated, these cube elements have to be selected and are attached to a pivot object. Afterwards the rotation of the pivot object is animated by using a spring (
useSpring
) and its imperativeset()
function.So far so good. My problem: If the rotations are triggered fast after another, the animation is sometimes interrupted and the cubeelements are detached from the pivot altough the rotation is not finshed to a complete 90 degrees turn.
Is there something I could do differently? I extracted the relevant code fragments to the following sandbox. The problem can be recreated, if the rotate button is triggered several times.
https://codesandbox.io/s/loving-bush-1t2ui
Hope someone can help me, thanks for the great work with the two packages!
Beta Was this translation helpful? Give feedback.
All reactions