Welcome to this new ‘series’ where I will be talking about the basis of expressions. Expressions may seem daunting at first (trust me, I thought the same), but they’re actually very useful and more people should learn to use them! Rather than boring you with complicated explanations like Java and other programming books, I’m going to try my best to keep it short, sweet, and simple. We will be taking in some basic expressions, decaf style, without all the complications and “caffeine,” to hopefully make your learning experience a bit more enjoyable.

Today, we’re going to be taking a look at an expression Aharon Rabinowitz wrote for my latest RGTV Episode: Submerged Motion Graphics. Rather than manually keyframing the Offset Turbulence parameter, Aharon suggested some expressions. Truth be told, I didn’t want to sit and explain all that through video format because I felt it would be best for me to do so through a written tutorial. Nevertheless, it’s something I wanted to share with you guys, Aharon the Great does not write wasted expressions!

Take a look:

Motion = time*-300;
 [effect("Fractal Noise")("Offset Turbulence")[0], Motion]

Keep in mind, we’re trying to animate the Offset Turbulence so it flows upwards only.

Acknowledge the variable:

Motion = time*-300

Rather than typing “time*-300” every time we want to use it, we simply replace it with an easy and simple variable: Motion. You can see that Aharon defined the variable first, then proceeded with the actual expression.

effect("Fractal Noise")("Offset Turbulence")

This is just the Offset Turbulence parameter. If you pickwhip the Offset Turbulence, this is what you’ll get (so nothing special). But, we did modify this expression by adding some stuff to the end.

[0], Motion]

The [0] stands for the X axis value, by inserting it we defined the X value as the X value (meaning the X value is not going to change. The X value is going to stay the X value, aka [0]). Usually, we would follow [0] by a [1], meaning the Y axis value, but remember we’re trying to animate this thing moving up, so we don’t want the Y value to stay the same! Rather than putting [1] for the Y value, we put Motion instead. Remember, Motion means: time*-300

So basically, the X axis stays the same because we put [0] for the X, which is itself. The Y axis value will have time*-300 applied to it which is going to animate it automatically without keyframes.

Every programmer knows how important it is to clean up code, here is the cleaned up version of the expression. It’s pretty self explanatory and simple:

X = effect("Fractal Noise")("Offset Turbulence")[0];
Y = time*300;
[X, Y]

Aharon simply combined all the “X” stuff into one group and defined it as “X”, then added all the “Y” stuff and called it “Y”. The final simple expression: [X, Y]. Clean and simple.

Just like that, you were able to write a simple two line expression, defined a variable, and animated something to change over time. This isn’t just limited to Offset Turbulence, try it out on other parameters as well! Many thanks to Aharon for the expression and inspiration for this series. My apologies for the long and boring looking post, most of this stuff was introducing the series. Next few Decaf tutorials will be a lot more simplistic, short, and simple. If you guys have any comments, feel free to leave them down below!