Expression Library

Dangling Object

Authors: Dan Ebberts, ReelSmart Productions

Creates a realistic drop and bounce effect for a sign or other object hanging by a string or strings.

This excellent tutorial walks you through the process for animating an object hanging by two strings. With some adaptation this expression can also be applied to an object hanging by one string, like a lightbulb). Note that the code provided in the video is the original Dan Ebberts code which assumes a start time of 0 for the effect. ReelSmart’s rendition, below, includes a tweak to make the Position and Rotation expressions time agnostic. 

Code Sample

Hover over the code and click the copy button.

				
					//For Drop Bounce of Object, add to Position: 


veloc = 20;
amplitude = 40;
decay = .5;
t = Math.max(0, (time - framesToTime(frames))); //replace "frames" with the frame number for the start point of your effect
y = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
value + [0, y] //this results in a very springy bounce. For a harder bounce, use the Drop Bounce expression from the main menu

//For the Swinging Rotation Effect, add to Rotation:

veloc = 7;
amplitude = 80;
decay = .7;
t = Math.max(0,(time - framesToTime(frames))) //replace "frames" with the frame number for the start point of your effect
amplitude*Math.sin(veloc*t)/Math.exp(decay*t)