View all expressions
Randomness

Auto-Wiggle When Near Another Layer

Automatically adjusts the wiggle amount based on distance to another layer.

Contributed by:


maxWiggle = 20;
// Maximum wiggle amount
maxFrequency = 10;
// Maximum wiggle frequency
maxDistance = 500;
// Maximum distance
target = thisComp.layer("TargetLayer").position;
dist = length(position, target);
// Map distance to wiggle amount and frequency
wiggleAmount = linear(dist, 0, maxDistance, maxWiggle, 0);
wiggleFrequency = linear(dist, 0, maxDistance, maxFrequency, 1);
wiggle(wiggleFrequency, wiggleAmount);

Auto-Wiggle When Near Another Layer

Practical use case

Useful for interactive UI animations, physics-based motion, or objects reacting when near another element.

Check out similar expressions

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

a mesh of elegant lines transparent image