Fusion Expressions

When building out animations especially complex animations it’s great to avoid making hundreds of keyframes when possible and that’s where Fusion Expressions come in. In fusion we’re going to be focused on building the Fusion expressions in a coding language called LUA. Think of this lua code as a way to tell each of the node inputs what to do for each frame very similar to keyframes.

Inputting expressions

Right clicking on any node input will give you a drop down in this list you will see the option for expressions.

Inside this expressions box you can use lua, math equations, or point to other Fusion input values of a similar type.

add fusion expressions

Getting values from another nodes.

For most values you’re going to first have the notes name followed by a period and the inputs name. When working with multi-value inputs such as X Y inputs this changes slightly.

For an example let’s use a rectangle mask. The name of this rectangle mask node is going to be Rectangle1.

If we wanted to use the width input for an expression we would write out

Rectangle1.Width

But if we wanted to use the Y value from the rectangle mask we would need to write out the expression slightly differently since this input has two values.

Rectangle1.Center.Y
rectangle mask node in fusion

Fusion expressions math library

Absolute value of xabs(x)
Arc cosine of x in radiansacos(x)
Arc sine of x in radiansasin(x)
Arc tangent of x in radiansatan(x)
Arc tangent of a/b (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of b being zero.)atan2(a, b)
Smallest integer(whole number) larger than or equal to xceil(x)
Cosine of x assumed to be in radianscos(x)
Hyperbolic cosine of xcosh(x)
Angle x (given in radians) in degreesdeg(x)
The value e power xexp(x)
Largest integer smaller than or equal to xfloor(x)
Remainder of the division of x by y that rounds the quotient towards zero.fmod (a, b)
m and e such that x = m2e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero)frexp(x)
a2b – b should be an integerldexp (a, b)
The natural logarithm of xlog(x)
The base-10 logarithm of xlog10(x)
The maximum value among its argumentsmax(a, b)
The minimum value among its argumentsmin(a, b)
Value of pipi
Value of the base(a) to the exponent(b) powerpow(a, b)
The angle x (given in degrees) in radiansrad (x)
The sine of x assumed to be in radianssin(x)
The hyperbolic sine of xsinh(x)
The square root of xsqrt(x)
The tangent of x assumed to be in radianstan(x)
The hyperbolic tangent of xtanh(x)

Fusion Expressions Shorthand

Fusion composition start and end

comp.RenderStart
comp.RenderEnd

Explanation return the starting frame number or end frame number


Current frame number

time

Explanation time in fusion is counted in frame number


if-then else

iif(Merge1.Blend == 0, 0, 1)

Explanation if Merge1 Blend value equals 0 then return a 0 else return a 1


Point is for two values for a XY location

Point(value1, value2)

Explanation Create a location on screen with X(value1) and Y(value2)

In: ,

Author:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *