Copy link to clipboard
Copied
I'm trying to make a layer scale up at its inPoint and then scale down just before its outPoint. Unfortunately, I'm not a coder, so I have a hard time understanding a lot of the syntax here. I'd love to get this done with just one expression to make everything faster instead of setting the keyframes individually.
I can get the separate expressions to work, so:
ease(time, inPoint, inPoint + 0.5, value * 0, value * 1)
makes the image scale up from the time it comes in, and
ease(time, outPoint, outPoint - 0.5, value * 1, value * 0)
makes the image scale down just before it disappears.
However, when I try to combine them like this:
if(time<=inPoint){
ease(time, inPoint, inPoint + 0.5, value * 0, value * 1)
}
else{
ease(time, outPoint, outPoint - 0.5, value * 1, value * 0)
}
It does the scale up properly, but it ignores the scale down.
If I try to combine them like this:
ease(time, inPoint, inPoint + 0.5, value * 0, value * 1) + ease(time, outPoint, outPoint - 0.5, value * 1, value * 0)
It does both scale animations, but the image goes to 200% for the duration it's onscreen until it scales down at the outPoint.
Is there a way to do this with just one expression I can save as a preset?
Try this:
if (time >= inPoint && time < outPoint - 0.5) {
ease(time, inPoint, inPoint + 0.5, value * 0, value * 1)
} else {
ease(time, outPoint - 0.5, outPoint, value * 1, value * 0)
}
I prefer adding the two ease values instead of using if/Else
t = time-inPoint;
sclIn = framesToTime(20);
sclOut = framesToTime(15);
fin = outPoint - inPoint;
scl1 = ease(t, 0, sclIn, 0, value[0] * 1 );
scl2 = ease(t, fin-sclOut, fin, 0, value[0]* 1);
scl = scl1 - scl2;
[scl, scl]
This gives me a 20-frame scale-in and a 15-frame scale-out. Subtracting the inPoint from time also gives you a "t" value that starts at zero. Subtracting the outpoint from the inpoint gives you the duration of the layer
...Copy link to clipboard
Copied
Try this:
if (time >= inPoint && time < outPoint - 0.5) {
ease(time, inPoint, inPoint + 0.5, value * 0, value * 1)
} else {
ease(time, outPoint - 0.5, outPoint, value * 1, value * 0)
}
Copy link to clipboard
Copied
I prefer adding the two ease values instead of using if/Else
t = time-inPoint;
sclIn = framesToTime(20);
sclOut = framesToTime(15);
fin = outPoint - inPoint;
scl1 = ease(t, 0, sclIn, 0, value[0] * 1 );
scl2 = ease(t, fin-sclOut, fin, 0, value[0]* 1);
scl = scl1 - scl2;
[scl, scl]
This gives me a 20-frame scale-in and a 15-frame scale-out. Subtracting the inPoint from time also gives you a "t" value that starts at zero. Subtracting the outpoint from the inpoint gives you the duration of the layer. I just used the original X value for scale.
I have many animations presets that have several moves at different times, and just adding the values derived by the interpolation method (ease(t, tMin, tMax, value1, value2) is a lot cleaner than stacking up a bunch of if/else arguments. I usually use sliders to control the move-in and move-out frame counts.
Hope this helps.
Copy link to clipboard
Copied
Ahhh, that works! Honestly, I'm going to save both of these - as I continue making videos, this one will probably help if I end up creating a bunch more animations, and I thiiiink I understand your explanation. It's super helpful. Thank you!
Copy link to clipboard
Copied
That works perfectly. Thank you!