Nuke expressions are so cool. It took me a while to understand how to use them but they are really powerful in what they can do. What they let you do is provide an equation for each pixel of the image. You have access to several built in variables, and the ability to define a few of your own. There's a library of built in functions you have access too as well. And it runs fast too!

A (non-comprehensive) rundown of the tools in the expression node are:

- Access to built-in variables r, g, b, a, x, y, frame, width, height
- A built-in library of functions (listed here)
- Access to other channels by their full layer.channel name, such as depth.Z
- Access to other nodes and their attributes via [value Transform2.translate.x]
- Conditional values via the tertiary format: condition ? trueValue : falseValue
- And my favorite: channel(x, y) to sample the color of other pixels, including interpolated subpixel values

Finally! All the simple image manipulations imagined in my mind, I could easily create! So many things are easier and simpler to me, when I just use an expression.

Need to invert the alpha and change its gradient direction? Put this in the alpha channel of an expression node

- 1 / (1 - a)

Need a linear-falloff circle shape?

- posX = 200
- posY = 350
- radius = 100
- dist = sqrt((x - posX)**2 + (y - posY)**2)
- rgba = clamp(1 - dist/radius, 0, 1)

One expression I used recently was to ease into scaling an image to the left of a particular x coordinate. It went like this:

- offset = 400
- factor = 0.9
- valid = x < offset
- newX = -(abs(x - offset) ** factor) + offset
- r = valid ? r(newX, y) : r
- g = valid ? g(newX, y) : g
- b = valid ? b(newX, y) : b
- a = valid ? a(newX, y) : a

You can take it pretty far with expressions. I built a mandelbrot fractal and kaleidoscope nodes out of expressions. The kaleidoscope was particularly fun to play with.

In summary, nuke nodes are fun. They're worth learning to use and being played around with. They can do some really powerful things if you have the math mind to express what you're trying to do.

Download my collection of saved nuke gizmos here for your fun and learning. Nuke is available for free for non-commercial purposes as of mid-2015. Yay!