-
Scale Expression with inertia bounce – start from zero
Hi everyone,
I have been using these forums for a long while and found them to be immeasurably helpful.
What I am trying to do now is get a layer to scale in and scale out at its in and out points, along with a bit of an inertia spring.
I have used one of Dan Ebberts scripts from one of the posts here and modified it a bit to work at in and out points.
The problem I am having is that the layer needs to be constantly re-sized to get somewhat reasonable results. Most of the time it bounces out OK although it never seems to really get to 0% scale. The in point is the one that doesn’t work properly though. Rarely can I get it to start at 0% scale. I have to have the layer scaled to the right size and tweak the ‘Scale’ setting in the expression. I normally have the variable set to sliders but have replaced them with my default settings here for easier dissecting.
I have the following script on a solid scaled at 40% in a 1050 x 576 comp. Solid was made comp size as I want this to work at any scale.
What I want to accomplish is to have the layer start at 0& scale and ramp up to whatever I set before applying the script. Then have a bit of inertia bounce that can be adjusted for intensity and length. At the minute the inertia bounce is working beautifully, I just need the scale to start and finish a 0%.
Then I want to be able to save it as a preset and have it save me hours of time over the next couple of years.
Really hope that I have made sense and that someone is able to tell me where I have gone wrong.
Regards
Justin Alexander
PS: Thanks to Roland R. Kahlenberg for pointing me to the correct forum for this issue
S =100; // Scale
A =20; // Amplitude
F =20; // Fequency
to = outPoint - time;
ti = time - inPoint;
inTrans = x=S*(1-Math.exp(-A*ti)*Math.cos(F*ti));
outTrans = y=S*(1-Math.exp(-A*to)*Math.cos(F*to));
value+ [inTrans,inTrans] + [outTrans,outTrans];