NEWS & TUTORIALS

on After Effects, Final Cut Pro, AVID and much more.

Categories

After Effects Video Tutorial: Rotating Squares + Expression

Caleb Ward
By Caleb Ward
By Caleb Ward

Sometimes animating motion in After Effects can throw you for a loop. For instance, ‘rolling a square’ is a bit more complex than you may think. In this video, you’ll learn how to tackle this animation with a simple expression. 

Motion design is a lot more math based than most people realize. Whether you’re writing expressions, interpolating keyframes or simply adding a slider adjustment, you’re going to use a lot of math when working in After Effects. If you have a strong math background, you’re at an advantage, but if you’re anything like me you may need a little help.

A recent video tutorial by Joey Korenman of School of Motion, posited a unique motion design dilemma: “How do you roll a square in After Effects?” The issue is trickier than it sounds. Squares have points that make a rolling effect difficult if you are just setting rotation keyframes.  If you simply rotated the square it would cut into the ground making the entire effect unbelievable, but if you had an expression to automatically compensate for the squares edges the problem would be solved.

Joey offered up his own solution using rigging and animation curves (download the rig from School of Motion). Then, AE pro and PremiumBeat blogger Mikey Borup piggybacked on Joey’s question, offering a solution that relies solely on an AE expression:

 

The video tutorial above explains how to use Mikey’s AE expression. Copy it and use in your own projects:

rot=transform.rotation;
scl=transform.scale[0]/100;
w=(this.width/2)*scl;
r=(degreesToRadians(rot))*2;
t=transform.position;
slider=effect(“Slider Control”)(“Slider”);
[t[0]+w*rot/45,t[1]-(Math.abs(slider*Mat­h.sin(r)))*scl];

Thanks for sharing, Mikey and Joey! You can check out more tips on Mikey’s popular AE channel or School of Motion’s ‘30 Days of After Effects‘.

Got AE tips to share? Let us know in the comments below!