Three days ago, I posted a new blog post about the latest portfolio piece of mine. One of the thing it contained was a GIF of the six side statues just randomly scaling up and down endlessly. Of course, I let the computer do the work. The secret to the effect? After Effect. I assume that you are comfortable in After Effects. So, here’s how it’s done.

Save The Photoshop File Right

Mostly because After Effects in an Adobe product, it can open up Photoshop files. That is crucial to the completion of our project. The best way the save the file is, after having a master file with everything possible, flatten the layers to keep as little as possible. We can even flatten down the bottom two angled sculptures with their shadows as you want them to scale exactly the same. The background also need to be on it’s layer. For this example, we have eight layers. Technically, you could merge the middle face with the background but I don’t recommend it because it’s nice to have them separate if you change your mind about what moves and what doesn’t.

Open in AE and Set It Up

Then, you want to open the file in After Effects. It will ask you what Import Kind you want. Select Composition - Retain Layer Sizes and Merge Layer Styles into Footage. Press on Ok. Just double-click on the Composition object in the Project panel and it will open neatly and aligned just like how it was in Photoshop.

What it looks like in After Effects

Expressions

The trick to the random scale effect is to use expressions.

When you want to create and link complex animations, but would like to avoid creating tens or hundreds of keyframes by hand, try using expressions. An expression is a little piece of software—much like a script—that evaluates to a single value for a single layer property at a specific point in time. Whereas scripts tell an application to do something, an expression says that a property is something.

With expressions, you can create relationships between layer properties and use the keyframes of one property to dynamically animate other layers. For example, you can use the pick whip to link path properties, so a mask can take its path from a brush stroke or a shape layer object.1

To add an expression, select all the layers and press S on the keyboard (that will bring up only the Scale property). Then, Alt-press on the Keyframe icon of the specific layer you need to add the expression to. Here it the JavaScript expression:

frame = Math.round(time/thisComp.frameDuration);

seed = Math.floor(frame/5);

seedRandom(seed,true);

s = random(50,120);

[s,s]

To adjust the rate at which every change in the layer’s scale occurs, replace the 5 in the second line by the desired amount of frames between every change. There, every 5 frames, the scale changes. I chose a different number between 1 and 10 as the frame gap for every layer. Also, you can adjust the minimum and maximum scale by playing with the numbers on the last line. For me, 50% is the lowest I’ll go and 120% and the highest. As, by default, the composition’s framerate is 29.976fps, and a GIF limits at 500 frames, your video can be about 16 seconds long without any issues.

Motion Blur and Saving

Motion Blur + Expressions

Once, every layer that you want to scale has its expression, turn on Motion Blur. That helps taking off a bit of the jerkiness of the whole GIF.

I have exported two version; a lossless, un-resized AVI video and a much smaller .mov file (resized at 1000px on the longest side). The “RAW” AVI video is totally optional as it takes up 50GB of space (in my case, the image was more than 35MP to begin with).

One Last Trip to Photoshop

To make that Quicktime .mov file a GIF, we need to go back to Photoshop. There, press ⌘⌃⇧S and make sure the size is at 1000px on the longest size. Be aware that you need to click the Looping: Forever checkbox in order for your GIF to loop endlessly. That’s not the default. Check out this blog to learn how to upload your GIF and have it display on Squarespace.

That was a very quick overview of how to make a randomly scaling GIF using After Effects and Photoshop. I hope you liked it!

Cheers,

Tristan

1: Adobe Help Page on After Effect, https://helpx.adobe.com/after-effects/using/expression-basics.html