**Your cart is currently empty!**

# 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.

## 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`

## Fusion expressions math library

Absolute value of x | abs(x) |

Arc cosine of x in radians | acos(x) |

Arc sine of x in radians | asin(x) |

Arc tangent of x in radians | atan(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 x | ceil(x) |

Cosine of x assumed to be in radians | cos(x) |

Hyperbolic cosine of x | cosh(x) |

Angle x (given in radians) in degrees | deg(x) |

The value e power x | exp(x) |

Largest integer smaller than or equal to x | floor(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 integer | ldexp (a, b) |

The natural logarithm of x | log(x) |

The base-10 logarithm of x | log10(x) |

The maximum value among its arguments | max(a, b) |

The minimum value among its arguments | min(a, b) |

Value of pi | pi |

Value of the base(a) to the exponent(b) power | pow(a, b) |

The angle x (given in degrees) in radians | rad (x) |

The sine of x assumed to be in radians | sin(x) |

The hyperbolic sine of x | sinh(x) |

The square root of x | sqrt(x) |

The tangent of x assumed to be in radians | tan(x) |

The hyperbolic tangent of x | tanh(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) *

## Leave a Reply