View all expressions
Interpolation

LookAt Expression in 2D Space

Directs a layer’s orientation towards another layer, as in a “look at” function.


function lookAtMe(fromPt, toPt){    lkAt = lookAt(fromPt, toPt);
if (toPt[1] > fromPt[1]){
return 180-lkAt[1]; }
else {
return lkAt[1]; }}
p0= transform.position; // look from point
p1=thisComp.layer("targetLayer").transform.position; // looked-at point
lookAtMe(p0, p1)

LookAt Expression in 2D Space

Practical use case

Ideal for creating interaction effects, like eyes or arrows that follow a moving object.

Check out similar expressions

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

a mesh of elegant lines transparent image