Use an expression to link rotation to position. 
Solvin' tutorials aren't full guides on how to create specific effects, instead I'm hoping you'll find these quick tips useful for when you're trying to find out or remember how to do "just that one thing". I know it can be frustrating to wade through a 15-30 minute tutorial when all you needed was the trick mentioned at the 11 minute mark. 
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.
[Edit: Yeah, I know I've changed the name, but my wife hated it and the joke was starting to get old. Plus this brings these videos inline with my other two series, Makin' and Startin']
Expressions
2D Layer
diameter=width;
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 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

You may also like

Back to Top