spring raise and then decrease #1909
Answered
by
JonnyBurger
martinlau01
asked this question in
Q&A
-
const scale = spring({
frame,
from: frame <= 20 ? 0 : 5,
to: frame <= 20 ? 5 : 0,
config: {
mass: 3,
damping: 20,
},
fps: videoConfig.fps,
}); I want to let scale from 0 to 20 in the first 20 frames, after that from 5 to 0, however, this is not possible with the above code, Any Help would be appreciate! |
Beta Was this translation helpful? Give feedback.
Answered by
JonnyBurger
Mar 9, 2023
Replies: 2 comments
-
finaly I run out this code , it works, but I don't know if this is the good way? const scaleUp = spring({
frame,
from: 0,
to: 5,
config: {
mass: 3,
damping: 20,
},
fps: videoConfig.fps,
});
console.log({scaleUp});
const scaleDown = spring({
frame: frame - 20,
from: 5,
to: 0,
config: {
mass: 3,
damping: 20,
},
fps: videoConfig.fps,
});
console.log({scaleDown});
const scale = frame >= 20 ? Math.max(1, scaleDown) : scaleUp; |
Beta Was this translation helpful? Give feedback.
0 replies
-
My recommendation is to add the transforms together = const scaleUp = spring({
frame,
from: 0,
to: 20,
config: {
mass: 3,
damping: 20,
},
fps: videoConfig.fps,
}) + spring({
frame: frame - 20,
from: 5,
to: 0,
config: {
mass: 3,
damping: 20,
},
fps: videoConfig.fps,
}); See also https://www.remotion.dev/docs/miscellaneous/snippets/adding-animations! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
martinlau01
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My recommendation is to add the transforms together =
See also https://www.remotion.dev/docs/miscellaneous/snippets/adding-animations!