top of page
Look At Target Expression
Transform, Dynamic, Dynamic Rotation, Animation Techniques, Advanced Expressions
Look At Target Expression
Automatically rotates a layer (like an eye or camera) to always face a target layer's position, perfect for tracking or aiming effects
The "Look At Target" expression in After Effects dynamically rotates a layer, such as an eye, object, or camera, to continuously face another layer's position. By calculating the angle between their positions, it creates a realistic tracking effect. This technique is ideal for animating interactive elements, character eyes, or camera movements that follow a moving object.
target = thisComp.layer("Target"); // Replace "Target" with your target layer's name
delta = target.position - position; // Calculate the difference in position
radiansToDegrees(Math.atan2(delta[1], delta[0])); // Convert angle to degrees
How to Use This Expression?
Animate an Eye Following a Ball: Place an eye layer and a moving ball layer.
Rename the ball layer to "Target".
Apply the expression to the eye's Rotation property.
The eye will rotate to follow the ball as it moves.
Point a Camera at a Moving Object: Parent the camera to a null object for flexibility.
Apply the expression to the null object's Rotation property to make it follow the target.
Trending
bottom of page