Squash and Stretch


This exercise demonstrates how you can use an expression to apply "squash and stretch" to an object. For this experiment, I imported two Illustrator graphics. I moved their anchor points to the bottom so that the stretching occurs relative to the "floor" of the comp. I keyframed the falling action and split each layer at the point it reaches the floor. I added the following expression to the scale property of each of the stationary pieces:


max_dev=25; // max deviation in pixels
spd=30;  //speed of oscillation
decay=1.0; //how fast it slows down

x=scale[0]+max_dev*Math.sin(spd*(time-in_point))/Math.exp(decay*time);
y=scale[0]*scale[1]/x;
[x,y]

The formula for "x" is just applying a decaying sine wave to the original scale. "y" is calculated to keep the area of the layer constant.

Adjust the deviation, speed and decay parameters as needed.