View all expressions
Motion

DVD Screensaver Bounce Effect

Moves a layer across the screen, bouncing off edges dynamically.

Contributed by:


// Get layer dimensionslayer
Bounds = sourceRectAtTime(time, false);
layerWidth = layerBounds.width;
layerHeight = layerBounds.height;
// Get comp dimensions
compWidth = thisComp.width;
compHeight = thisComp.height;
// Set automatic boundaries based on layer size
minX = layerWidth / 2;
maxX = compWidth - layerWidth / 2;
minY = layerHeight / 2;
maxY = compHeight - layerHeight / 2;
// Speed settings
speedX = 300;
speedY = 200;
// Time calculation
t = time - inPoint;
// Calculate position
x = minX + (t * speedX) % ((maxX - minX) * 2);
y = minY + (t * speedY) % ((maxY - minY) * 2);
// Reflect position if it hits the bounds
if (x > maxX) x = maxX - (x - maxX);
if (x < minX) x = minX + (minX - x);
if (y > maxY) y = maxY - (y - maxY);
if (y < minY) y = minY + (minY - y);
[x, y];

DVD Screensaver Bounce Effect

Practical use case

Recreates the classic DVD logo bounce effect for motion design, screen savers, or fun retro animations.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image