Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Make cube rotate around its edge without having to keyframe the anchor point?

New Here ,
Mar 02, 2025 Mar 02, 2025

Hello! I'm in After Effects CC 2024 working to animate a cube which is meant to rotate multiple times around its furthermost edge, and the way I'm doing it is by keyframing the anchor point every time it does a full 90° rotation but it's impractical and inefficient – is there any way to do this without manually keyframing?

 

Here's a reference GIF for what I'm trying to achieve; made this real quick in another app to get the point across so it's not in the best quality...

 

 

1000076108.gifexpand image

TOPICS
Expressions
87
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2025 Mar 04, 2025

This is an interesting and tricky problem. I've been tinkering with it for a couple of days and here's what I've got. If the layer is a solid with the anchor point centered, you can use a position expression like this to "roll" the square in accordance with the rotation property:

w = width;
r = Math.sqrt(2*w*w)/2;
a = rotation%90;
a += a < 0 ? 90 : 0;
n = Math.floor(rotation/90);
a0 = Math.PI*5/4;
a1 = Math.PI*7/4;
a2 = linear(a,0,90,a0,a1);
c0 = Math.cos(a0);
x = n*w + r*(Math.cos(a2) - c0);
s0 = Math.sin(a0);
y = r*(Math.sin(a2) - s0);
value + [x,y]

If you're using a square shape layer (with anchor point centered), you need to change the first line to this:

w = content("Rectangle Path 1").size[0];

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2025 Mar 12, 2025
LATEST

Sorry for a late reply but I only got to touch the project now; this expression is doing exactly what I was attempting to achieve. Thank you so much for solving my problem!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines