# @masd.lab on Instagram

- **Type:** Video
- **Original URL:** https://www.instagram.com/p/DB1XCqIM7uW
- **Gondola URL:** https://gondola.cc/posts/61255974-masdlab-instagram
- **Thumbnail:** https://img.gondola.cc/tr:w-,h-,fo-auto/postThumbnails/80b2cbb182.jpg
- **Posted:** 2024-11-01T15:27:24.000+00:00
- **Account Owner:** Marcos Silva (@masd.lab) — https://gondola.cc/masd.lab

## Caption

Expression n.3 Directional Angle Based Rotation.

This expression calculates the angle between a layer and a target layer, adjusting the layer’s rotation dynamically to always face towards the target. As the target layer moves, the layer with this expression will rotate, keeping it aligned in the direction of the target.

//apply on Rotation property

var targetLayer = thisComp.layer(“Shape Layer 2”);
var target = targetLayer ? targetLayer.transform.position : [0, 0];
var myPos = thisLayer.transform.position;
var angle = Math.atan2(target[1] - myPos[1], target[0] - myPos[0]);
var angleDeg = radiansToDegrees(angle);
angleDeg + 90;

Find more: YouTube https://bit.ly/3AcQQeT
workingFiles.Scripts https://bit.ly/3ZJmGu2

#AfterEffects #AETips #MotionDesign #ExpressionMagic #DirectionalRotation #LayerAlignment #DesignTutorial #MotionGraphics #AnimationTips #CreativeEffects #AEExpressions #AutoRotation #VisualEffects #LayerTargeting

## Stats

- **Views:** 1,102
- **Likes:** 148
- **Shares:** 0
- **Comments:** 0

## Tags

directionalrotation, layeralignment, expressionmagic, creativeeffects, autorotation, aeexpressions, visualeffects, aetips, designtutorial, aftereffects, motiongraphics, motiondesign, layertargeting, animationtips

---
Copyright (c) Gondola