Just the Tip (a new set of mini-tutorials for After Effects) - Rolling a ball using Expressions

COW Blogs : Graham Quince's Blog : Just the Tip (a new set of mini-tutorials for After Effects) - Rolling a ball using Expressions

I'm currently prepping a much larger series of tutorials, but to take a break from those, I've also be creating a series of short tutorials for the things I go back to again and again - but not so frequently that I have them memorised. I find myself searching the internet (and the Cow of course) for these tips, but then often have to wade through a 30 minute tutorial - just to find that one thing... that one trick. Well, these mini-tuts are built for that purpose. I hope you find them useful.

This tutorial uses an expression to calculate how much a circle / image should rotate based on its horizontal position. I've then adapted the expression slightly to help you roll 3D objects too.

CC Sphere in one dimension:
diameter=effect("CC Sphere")("Radius")
pi=Math.PI;
circumference=diameter*pi;
rot=360/circumference;
Xpos=thisLayer.transform.position[0];
scalePercent=thisLayer.transform.scale[0]/100;
rot*Xpos/scalePercent

CC Sphere coming towards camera:
diameter=effect("CC Sphere")("Radius")
pi=Math.PI;
circumference=diameter*pi;
rot=360/circumference;
Xpos=thisLayer.transform.position[0];
scalePercent=thisLayer.transform.scale[0]/100;
rot*Xpos/scalePercent*-1

Here you'll find a bunch of tutorials for using After Effects (mainly). I have a YouTube channel, called ShiveringCactus (long story - not funny anymore) where I post the videos.