ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Continuous bounce

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Kenji Takahashi
Re: Continuous bounce
on Jun 30, 2020 at 1:42:22 pm

Yeah this one is cleaner.

I was actually looking for solution to do this.



I call it inertial animation. (or Ice animation ☺ )
Basically with the tweak in frequency and decay I can make inertia in movement without null parenting, with fever keyframes and without tweaks to keyframe velocity.
Example above was done with the code below and just easing first keyframe of movement. (animation must be done in linear fashion, forward, keyframe by keyframe. Just like pushing hockey puck on ice)

Once again thanks Dan!

freq = 0.001;
decay = 0.6;
val = value
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 1){
w = freq*Math.PI*2;
for (i = 2; i <= n; i++){
t = time - key(i).time;
if (t > 10/decay) continue;
amp = velocityAtTime(key(i).time - .001);
val += amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}
}
val


Posts IndexRead Thread 


Current Message Thread:





© 2020 CreativeCOW.net All Rights Reserved
[TOP]