bounce animation tutorial by potterhead.asap
// Control the bounce intensity
amplitude = effect("Bounce Amount")("Slider"); // Bounce intensity
frequency = 3; // Frequency of the bounce
decay = 4; // How quickly it settles
// Get the time after the second keyframe
t = time - key(2).time;
if (t < 0) {
// Before the second keyframe, just use the position value
value;
} else {
// Final position (second keyframe position)
finalValue = valueAtTime(key(2).time);
// Bounce calculation with a smoother curve (optimized)
bounce = amplitude * Math.sin(frequency * t * Math.PI * 2) / Math.exp(decay * t);
// Apply the bounce, but ensure it does not exceed the final position
finalValue + [0, bounce];
}
Public Last updated: 2024-11-12 05:08:11 PM