Expression Library

Wheel

Applied to the rotation property, creates a layer that rolls realistically (without slipping) when you drag it horizontally.

Code Sample

Hover over the code and click the copy button.

				
					var circumference=content("My Shape").content("My Shape  Path 1").size[0]*Math.PI;// Or replace everything before "Math" with the pixel width of your shape or layer object.
var distance= transform.position[0] - transform.position.valueAtTime(0)[0] //if your wheel layer is parented to another layer, use the x transform position values of the parent layer
(distance/circumference)*360
				
			

Other Notes