Advertisement
perazite

AE Inertial Bounce Expressions

Jun 27th, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://www.youtube.com/watch?v=653lxeVIyoo
  2.  
  3. // Inertial Bounce - Created by Animoplex: www.animoplex.com
  4. // Original Version: http://www.graymachine.com/top-5-effects-expressions/
  5. // Modified expression for a smoother bounce effect and easier editing. Use this on any property with two keyframes to get a nice bounce effect that is based on velocity of the value change. Perfect for a scale from 0 to 100 or a speedy rotation that needs some extra life. Adjust amp, freq and decay values to tweak the effect. Amp is intensity, freq is bounces per second, and decay is the speed of decay, slow to fast.
  6. // Full Tutorial: https://www.youtube.com/watch?v=653lxeVIyoo
  7.  
  8. amp = 5.0; freq = 2.0; decay = 4.0;
  9.  
  10. n = 0;
  11. if (numKeys > 0) {
  12.   n = nearestKey(time).index;
  13.   if (key(n).time > time) { n--; }
  14. }
  15. if (n == 0) { t = 0; }
  16. else { t = time - key(n).time; }
  17. if (n > 0 && t < 1) {
  18.   v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
  19.   value + v*(amp/100)*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
  20. }
  21. else { value; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement