Expressions
Expressions are the most convenient way to automate courses of motions, and regular or repetitive animations without scripting knowledge. With expressions you do not have to worry about keys, because you simply enter a formula and can immediately see the results. Expressions can also be made event-based: you define a certain condition to switch on a certain feature, e.g. rigid body dynamics. Such a condition could either be a particular frame or the position of a null object, to name but a few.
RealFlow offers another feature: the combination of expressions and key-based curves. Combining key-based curves and expressions can help you in many situations: for example, when you want to add some noise to an animation or create secondary motions within a higher-ranking movement. A click on the “+” button, next to an expression, will do the job for you. The result is a completely new curve, showing characteristics of the animation and the expression – a hybrid type.
=sin(t*5)
Available Functions and Operators
The "Insert" button provides several submenus:
Unary functions | The available mathematic functions, e.g. sine, cosine, square root, etc. |
---|---|
Binary functions | The available mathematic operators: +, -, >, <, etc. |
Tertiary functions | The "if" condition. |
I vars | The time-based variables t (seconds), frames, and fps. |
D vars | Here you can find lists with all parameters of the scene's nodes. You can couple them with an expression to trigger a certain event. |
Constants | Here you can find a few important constants, e.g. Pi or e. |
Examples and Useful Expressions
Here are several useful expressions for your daily work - you can substitute the factors with your own values.
Basic sine curve | sin(t) |
---|---|
Basic cosine curve | cos(t) |
Create five times more ups and downs | sin(t*5) | cos(t*5) |
Create ups and downs between -3.0 and 3.0 | 3*sin(t) | 3*cos(t) |
Shift the entire sine curve by 1.5 seconds | sin(1.5+t) |
Switch a node's simulation state from "Inactive" to "Active" at frame 50 | if(f>49,1,0) |
Set an emitter's "Speed" value from 2.0 to 0.0 when a sphere's X position is greater than 1.0 | if(sphere01.position.x>1.0,0.0,2.0) |
Create a random value between 0.0 and 2.0 | rnd(2.0) |
Add noise between 0.0 and 1.0 to a sine curve | sin(t)+rnd(1.0) |
Create circular motions around the vertical axis (two expressions!) | X position: sin(t*3) and Z|Y position: cos(t*3) |
Activate an object's "Active rigid body" state at t = 2.5 seconds | if(t=2.5,1,0) |
Switch from "Active rigid body" to "Passive rigid body" at frame 10 | if(f>9,2,1) |
Add a vertical offset of 2.0 to a sine curve | 2+sin(t) |
Create a falling exponential curve starting at 5.0 (frame 0) | 5*exp(-t) |
Make the exponential curve decrease faster | 5*exp(-t*3) |
Animate an emitter's rotation around an axis between -30° and 30° | sin(t)*15 |
Animate an emitter's rotation around an axis between 60° and 80° | 70+sin(t)*10 |
Randomize the rotation from above between 60°- 65° and 75°- 80° | 70+sin(t)*(5+rnd(5)) |
Create a zig-zag curve with many repetitions | tan(sin(t*10)) |
Create a smooth acceleration effect with a position parameter expression | sinh(t) |