Copy link to clipboard
Copied
var ctrl = thisComp.layer("Controller");
var bounceHeight = ctrl.effect("Bounce Height")("Slider");
var bounceSpeed = ctrl.effect("Bounce Speed")("Slider");
// Get the original position of the layer
var originalPos = transform.position;
// Calculate time-based phase for the bounce
var t = time * bounceSpeed;
// Create a time loop for continuous bouncing
var loopTime = 2 * Math.PI; // One full oscillation period
var loopProgress = (t % loopTime) / loopTime; // Normalized progress within one period
// Apply easing function to create a smooth bounce effect
var easedProgress = ease(loopProgress, 0, 1, 0, 1); // Eases from 0 to 1
// Calculate the vertical position with a bounce effect and easing
var bounceY = originalPos[1] + Math.sin(easedProgress * Math.PI * 2) * bounceHeight;
// Maintain the original X position
var bounceX = originalPos[0];
// Set the new position
[bounceX, bounceY];
Copy link to clipboard
Copied
I think the ease is messing things up. If you just use loopProgress instead of easedProgress, does that give you what you want?