ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Intertial Bounce Effect... but backwards?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brent Taylor
Intertial Bounce Effect... but backwards?
on Jan 14, 2015 at 8:05:02 pm
Last Edited By Brent Taylor on Jan 14, 2015 at 9:26:06 pm

I've been using the inertial bounce expression from this website:

http://www.graymachine.com/blog/my-top-expressions

(Code Below)

I'm trying to do the same effect, but in reverse. In other words, rather than moving and then swinging to a stop, I want it to be at rest, swing bigger and bigger, and then go.

To see what I'm trying to do, use the code below on the rotation of an object. Put two points... one at 0 degrees and one at 90. Then just play the animation you get in reverse.

Any idea how to do that? I feel like there should be a simple tweak I can make to the code to do it, but nothing I've tried so far works.

Another step from that which would be really cool would be to be able to do both in the same animation.

Thanks for any help.

amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}}
if (n == 0){ t = 0;
}else{
t = time - key(n).time;
}
if (n > 0 && t &lt; 1){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value
}


Return to posts index

Fahd Chishty
Re: Intertial Bounce Effect... but backwards?
on Jan 21, 2015 at 6:13:44 am

Try this.

freq = 2;
decay = 5;
delay = 0.15;
dur = 0.12;
myDelay = delay;
t = time - (inPoint + myDelay);
startVal = 539 ;
endVal = 540;
amp = (endVal - startVal)/dur;
w = freq*Math.PI*2;
ans=endVal + amp*(Math.sin(t*w)*Math.exp(decay*t)/w);
[transform.position[0], ans]




--
Fahd Chishty
Motion Design Artist
MotionCue


Return to posts index

Brent Taylor
Re: Intertial Bounce Effect... but backwards?
on Jan 21, 2015 at 5:46:57 pm

Thanks Fahd!

That's a good start but not quite what I'm looking for.

The way the position's movement starts small and then increases is great! Now we just need to apply it to the right thing...

Right now it doesn't respond to keyframing. Ideally it would do this between two keyframes like the inertial bounce script.

Also, this specifically outputs Position and doesn't work on other elements. What I want to do is affect the layer the expression is on (again like inertial bounce). I think that means affecting velocity.

I will mess around with your version and see what I can come up with. Open to suggestions as well. Thanks again.


Return to posts index


Fahd Chishty
Re: Intertial Bounce Effect... but backwards?
on Jan 23, 2015 at 8:35:52 am

To make respond to keyframes, you need to put values of startVal and endVal by keys.

startVal = key(1);
endVal = key(2);

Secondly, to solve the position only problem, I replace the transform.position[0] by value[0]
Or if you want to animate the 2nd value make it [ans, value[1]]

freq = 2;
decay = 5;
delay = 0.15;
dur = 0.12;
myDelay = delay;
t = time - (inPoint + myDelay);
startVal = key(1) ;
endVal = key(2);
amp = (endVal - startVal)/dur;
w = freq*Math.PI*2;
ans=endVal + amp*(Math.sin(t*w)*Math.exp(decay*t)/w);
[value[0], ans]


--
Fahd Chishty
Motion Design Artist
MotionCue


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]