Animation Maker

Ease curves in Nuke, with just a right-click.

menu

I have made a little extension to Nuke that when right-clicking any animatable value on any node you can choose ‘Animation Maker…‘ from the pop up menu and a whole suite of customisable animation curves can be chosen. When you’re happy, it generates the expression to form that curve and puts it into the knob in question. It also adds a user tab to the node with sliders so you can refine it on the fly. No extra nodes or expression lines in your script and it’s available everywhere.

It does all the maths for you.

Contains ease curves such as Quad, Exponential, Bounce and Elastic. Wave curves such as Sine, Random, Noise, Triangle and Sawtooth. Options to combine a wave with an ease curve, turn a wave into a ‘square’ version or create a sequence of blips at certain intervals.

All contained in one .py file. No gizmos required. Just put the file in your .nuke directory (or wherever your plugins directory is located), then add two lines to your menu.py.

Download here

This supersedes my previous WaveMaker tool, so no need to have both installed.

AnimMaker

Pop up dialogue in Ease mode, showing the motion with a growing circle, a moving circle and a circle fading from black to white.

AnimMaker2

Pop up dialogue in Wave mode showing an example noise wave.

tab

When CREATE is pressed, a new tab like this will appear on the node.

expression

An expression will be put into the chosen knob which is linked to the new tab’s controls.

easeout

An example Expo Ease Out curve

ease

An example Expo Ease In curve

easeinandout

An example Expo Ease In & Out curve

bounce

An example Bounce curve

elastic

An example Elastic curve

noise

An example Noise wave

waveEase

An example Sine wave combined with a Linear ease in.

blip

An example Blip animation made from a Sine wave.

Advertisements

WaveMaker v4

WaveMaker v4 available

 

Edit on 12/10/2013: This tool has been superceded by my new tool Animation Maker.

If you are familiar with my gizmo WaveMaker, I have made another version with two differences:

1) BlipMaker added. Allows you to generate blip animations for animating flashing beacons, LED lights or anything that needs to blip on for a frame or so every few seconds. WaveMaker itself can’t generate such a curve, it can only create squared versions of existing waves, meaning you could get it to come on for a frame, but it would only be off for another frame before it came on again. BlipMaker lets you choose the ‘on’ length and ‘off’ length separately. Examples below.

2) Instead of sharing the gizmo, I have provided a .nk file with a group node inside. If you want to use it as a gizmo, just load up the file, load the group in the properties tab, and Export as Gizmo… from the Node tab. However if you want to avoid problems when sharing your scripts, you can just import this .nk file into your script whenever you need it. The third, best option is to use the provided example menu.py file to create a custom button in your toolbar that looks and behaves like a regualar gizmo but is in fact just importing that .nk file each time you press it.

Download the zip file here

BlipMaker

Example curve: Blip of one frame, every 24 frames

Example curve: Soft blip over three frames, every 24 frames

Example curve: Three one frame blips, every 24 frames

Example curve: Combination pattern of blips with different settings, every 24 frames

These are just a few examples, you can play around with the sliders to get all sorts of combinations. Feel free to drop me a line or leave a comment if you use WaveMaker in any of your projects, I’m always interested to see how people use it.

If you just need to grab these expressions quickly, have a look this article where I break it down further.

Nuke wave expressions to copy and paste

Using waves to drive animation in Nuke

Creating repeating or random patterns in the curve editor can often be made easier by using expressions that describe a curve. Sine, noise and random functions are very useful, but forcing them into the exact shape you want can be a little time-consuming. So, following my previous post talking about my gizmo WaveMaker, I thought I’d share some handy expressions it uses which you can copy and paste straight from this blog when you need them, rather than installing the gizmo itself.

Edit on 12/10/2013: I have just released Animation Maker, a handy Nuke extension that contains all the waves talked about here, plus lots of Ease curves too. See the article here.

Click on any value in any node, press ‘=’ and type an expression. Right click and choose ‘Curve Editor…’ to view the curve.

These expressions give you full control over the width, height and position of the wave. Either replace the following variables with your actual values, or add your own sliders to the node so you can adjust them on the fly (see below for how to do that).

waveLength (how many frames between peaks of the wave)
minVal (the wave will never go below this value)
maxVal (the wave will never go above this value)
offset (shift the wave back and forth in time)

Edit on 15/01/12: I have also provided simple versions that will work immediately once you paste them in. They will just produce a wave between 0 and 1 but that may be all you need.

Some useful wave expressions:

Sine

(((sin(((frame*(pi*2/(waveLength/2))/2)+offset))+1)/2) * (maxVal-minVal) ) + minVal

Simple version:  (sin(frame/5)/2)+0.5  (Wave between 0 and 1, replace the ‘5’ to adjust speed) 

Square

((((sin(((frame*(pi*2/(waveLength/2))/2)+offset))+1)/2) * (maxVal-minVal) ) + minVal) > ((maxVal/2)+(minVal/2)) ? maxVal : minVal

Simple version:  (sin(frame/5)/2)+0.5 > 0.5 ? 1 : 0  (Wave between 0 and 1, replace the ‘5’ to adjust speed)

Triangle

(((((2*asin(sin(2*pi*(frame/waveLength)+offset)))/pi) / 2)+0.5) * (maxVal-minVal) ) + minVal

Simple version:  (((2*asin(sin(2*pi*(frame/30))))/pi) / 2)+0.5  (Wave between 0 and 1, replace the ’30’ to adjust speed)

Sawtooth

((1/waveLength)*(((frame-1)+offset) % waveLength) * (maxVal-minVal) ) + minVal

Simple version:  ( 1 / 30 )*( (frame-1) % 30)  (Wave between 0 and 1, replace the two ’30’s to adjust speed)

Random

((random((frame/waveLength)+offset)) * (maxVal-minVal) ) + minVal

Simple version:  random(frame/5)  (Wave between 0 and 1, replace the ‘5’ to adjust speed)

Noise

(((1*(noise((frame/waveLength)+offset))+1 ) /2 ) * (maxVal-minVal) ) + minVal

Simple version:  (noise(frame/5)/2)+0.5  (Wave between 0 and 1, replace the ‘5’ to adjust speed)

Bounce

((sin(((frame/waveLength)*pi)+offset)>0?sin(((frame/waveLength)*pi)+offset):cos((((frame/waveLength)*pi)+offset)+(pi/2))) * (maxVal-minVal) ) + minVal

Simple version:  sin(((frame/10)*pi)) > 0 ? sin(((frame/10)*pi)) : cos(((frame/10)*pi)+(pi/2))  (Wave between 0 and 1, replace the ’10’s to adjust speed)

Sawtooth (parabolic)

((sin((1/(pi/2))*(((frame-1)+offset)/(waveLength/2.46666666)) % (pi/2)))>0.99999? 1 : (sin((1/(pi/2))*(((frame-1)+offset)/(waveLength/2.46666666)) % (pi/2))) * (maxVal-minVal) ) + minVal

Sawtooth (parabolic, reversed)

((cos((1/(pi/2))*(((frame-1)+offset)/(waveLength/2.46666666)) % (pi/2)))>0.99999? 1 : (cos((1/(pi/2))*(((frame-1)+offset)/(waveLength/2.46666666)) % (pi/2))) * (maxVal-minVal) ) + minVal

Sawtooth (exponential)

((((((exp((1/(pi/2))*(((frame-1)+offset)/(waveLength/4.934802)) % pi*2)))/534.5)) – 0.00186741)>0.999987? 1 : (((((exp((1/(pi/2))*(((frame-1)+offset)/(waveLength/4.934802)) % pi*2)))/534.5)) – 0.00186741) * (maxVal-minVal) ) + minVal

*Note: the waveLength value doesn’t really correspond to the peaks in Random or Noise waves, so you will probably need a smaller wavelength value for those.

To add your own sliders:

  1. Right click your node, choose ‘Manage User Knobs…’
  2. Click ‘Add…’ and choose ‘Floating Point Slider…’
  3. Type ‘waveLength’ into its name and label boxes. Give it a max and min value of 0 and 100.
  4. Repeat with each of the four variable names (above).

These  four sliders will appear in the ‘User’ tab of the node. You may find it better to create a ‘NoOp’ node, add the above sliders, but also add several extra floating-point sliders called ‘Wave1’, ‘Wave2’, ‘Wave3’ etc. This way you can use the same sliders to control several different expressions, then you can use any one of them to drive animations in your script.

It’s worth noting many of these wave shapes can be created using a few keyframes and telling nuke to ‘loop’ that section. But using expressions with a few sliders you can mess around with them a lot easier. Besides, maths is fun.

One more thing:

To describe a CIRCLE, put this in the X: 

(((sin(((frame*(pi*2/(waveLength/2))/2)+offset))+1)/2) * (maxVal-minVal) ) + minVal

and this in Y:

(((cos(((frame*(pi*2/(waveLength/2))/2)+offset))+1)/2) * (maxVal-minVal) ) + minVal

Simple version (X): sin(frame/5)*300

Simple version (Y): cos(frame/5)*300

(replace the ‘5’ to adjust speed, replace the ‘300’ to change the circle size)

Tip: put it in the X and Z in a TransformGeo after a Card to make a carousel type animation.