This After Effects Expressions Technique Changes Everything
🔥 Ready to unlock After Effects' full potential? Dive deeper: https://jkinmo.com/tsflc3 Download Code Runner: https://jkinmo.com/gn28fe Browse My Tools: https://jkinmo.com/mnaa7j Jake In Motion Discord: https://discord.com/invite/b5PkuCCCAu --------------------------------------- Ever wanted a layer to follow its parent chain's transformations, but NOT their rotation? Standard parenting in After Effects links everything together, but with a few lines of expressions, we can unlink the rotation to keep layers perfectly upright no matter how much the parent (or its parents) rotates. In this tutorial, I’ll show you an awesome technique for using a while loop expression that counteracts full parent chains of rotation. The Expression Code: Copy and paste this into the Rotation property of your layer: var totalParentRotation = 0; var currentLayer = thisLayer; while(currentLayer.hasParent) { currentLayer = currentLayer.parent; totalParentRotation += currentLayer.rotation; } value - totalParentRotation; How it works: The Loop: We use a while loop to climb up the parenting chain. The Accumulator: We add up the rotation values of every parent, grandparent, etc. The Calculation: We subtract that total from the current layer to stabilize it (Counter-Rotation). --------------------------------------- 📸Instagram: https://www.instagram.com/jakeinmotion 🐤X: https://x.com/jakeinmotion 🏷️ Tag @jakeinmotion if you learned something! Chapters 00:00 Intro 00:50 What this technique does 02:07 Rig Walkthrough 02:44 The simple Way 04:17 Project Setup 05:00 Defining Variables 07:15 Writing a While Loop 08:09 The Condition 08:52 Redefining Variables 11:47 The Final Expression 13:33 Making the Expression Flexible 14:39 Applying the Expression to Other Layers 15:28 Applying Expression with Code Runner 15:39 Code Runner 16:53 Balancing Shapes Example 17:46 Chain Links Example
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.