In the expression editor, the Functions tab lists every function, sorted into five groups. This page says what each function does and which values it needs. Unlike in the tab, the groups here are not in alphabetical order but in order of how often you need them: Logic first, Animation last. How to insert a function is explained in Use the expression editor.
You write functions in capitals, with the values after them in brackets, separated by commas: MAX(10, 20). Text and colors go in backticks: `#0050ff`. In the list below, the brackets hold placeholders. Put your own values there.
Logic
For IF, NOT, AND and OR, false, empty text and missing values count as false. Everything else counts as true, including the number 0.
IF(condition, then, else): returnsthenifconditionis true, otherwiseelse. For example,IF(BIGGER(price, 100), 10, 0)gives 10 ifpriceis greater than 100, otherwise 0.SWITCH(value, case1, result1, case2, result2, …, default): comparesvaluewith the cases in turn and returns the result of the first case that is equal. If none matches, it returnsdefault. Never leave outdefault: without it,SWITCHdoes not check the last case.BREAKPOINTS(value, start, limit1, result1, limit2, result2, …): returns the result of the highest limit thatvaluereaches. Ifvalueis below all limits, it returnsstart. Put the limits in ascending order.BREAKPOINTS(headline.width, 60, 300, 48, 600, 36)gives 60 below 300 pixels of width, 48 from 300 and 36 from 600.EQUAL(a, b): true ifaandbare exactly the same. The number5and the text`5`are not the same.BIGGER(a, b): true ifais greater thanb.BIGGEREQUAL(a, b): true ifais greater than or equal tob.SMALLER(a, b): true ifais less thanb.SMALLEREQUAL(a, b): true ifais less than or equal tob.NOT(value): true ifvalueis false, and the other way round.AND(a, b, …): true if all values are true.OR(a, b, …): true if at least one value is true.IS_EMPTY_STRING(value): true ifvalueis an empty text. A text made of spaces is not empty.PROJECT_STATE(combinations, seed): for advanced users.combinationsis a list of lists of variants. The function builds every possible combination from them and picks one withseed, a number from 0 to 1. The result holds the values of the chosen variants.
Helpers
QR_CODE(text): returns the address of a QR code image fortext, 150 × 150 pixels. Use it as the image of an image element, for exampleQR_CODE(website).FLATTEN_LIST(list, path): takes the same value from every entry of a list.FLATTEN_LIST(team, `name`), for example, gives all names of a collectionteam.ELEMENT(name, number, …): reads one copy of an element that repeats with Iteration. The first copy has the number 0. If the repetition sits inside another one, the name and number of the inner repetition follow:ELEMENT(`group1`, 0, `text1`, 2).FIND_DUPLICATE(name, number): reads the element or variable namedname_number.FIND_DUPLICATE(`photo`, 2), for example, readsphoto_2. Withoutnumber, it readsnameitself.GET_FEATURES(text): returns the single pieces of a text's lines with their font and measurements, for exampleGET_FEATURES(headline).ITERATE_PATH_FEATURES(type, count, function): createscountpoints of a path of the kindtype, for example`line`.functionworks out the coordinates of each point from its number, starting at 0:ITERATE_PATH_FEATURES(`line`, 5, (i) => ({ x: i * 40, y: 0 })).
Math
The calculating functions also take lists and read numbers from text: `20px` counts as 20.
Calculating:
ADD(a, b, …): adds all values.SUB(a, b, …): subtracts all further values froma.MULT(a, b, …): multiplies all values.DIV(a, b, …): dividesaby all further values.POW(a, b):ato the power ofb.SQRT(a): the square root.CBRT(a): the cube root.ABS(a): the absolute value, so the number without a minus.SIGN(a): -1 for negative numbers, 1 for positive ones, 0 for 0.EXP(a): e to the power ofa.LOG(a, base): the logarithm ofatobase. Withoutbase, the natural logarithm.
Rounding: for normal rounding, use FLOOR(a + 0.5).
CEIL(a): rounds up.CEIL(3.2)gives 4.FLOOR(a): rounds down.FLOOR(3.7)gives 3.TRUNC(a): cuts off the decimals.TRUNC(-3.7)gives -3.
Statistics and chance:
MAX(a, b, …): the largest value.MAX(10, 20)gives 20.MIN(a, b, …): the smallest value.MEAN(a, b, …): the average.MEDIAN(a, b, …): the middle value. Give the numbers one by one, not as a list.RANDOM(min, max): a random number betweenminandmax. With only one value, it lies between 0 and that value, without values between 0 and 1. It changes with every new calculation.
Converting values:
PROJECT(x, a1, a2, b1, b2): convertsxfrom the rangea1toa2into the rangeb1tob2. Values outside end up at the edge.PROJECT(50, 0, 100, 0, 1)gives 0.5.PROJECT_TO_UNIT_INTERVAL(x, a1, a2): convertsxfrom the rangea1toa2into the range 0 to 1.PROJECT_FROM_UNIT_INTERVAL(x, a1, a2): convertsxfrom the range 0 to 1 into the rangea1toa2.
Angles: these functions work in radians, not degrees. 180 degrees are 3.14159.
SIN(a),COS(a),TAN(a): sine, cosine and tangent.ASIN(a),ACOS(a),ATAN(a): the inverse functions. They return an angle.ATAN2(y, x): the angle to the point with the coordinatesxandy. Note thatycomes first.SINH(a),COSH(a),TANH(a),ASINH(a),ACOSH(a),ATANH(a): the hyperbolic functions and their inverses.
Color
All color functions take a color as text, for example `#0050ff`. Most of them return a new color as a hex code.
amount is a share from 0 to 1 and changes relative to the current value: COLOR_LIGHTEN(color, 0.2) raises the lightness by 20 % of its current value. A value that is 0 therefore stays 0. Black, for example, does not get lighter with COLOR_LIGHTEN.
Lightness and saturation:
COLOR_LIGHTEN(color, amount): makes the color lighter.COLOR_DARKEN(color, amount): makes the color darker.COLOR_LIGHTNESS(color, value): sets the lightness tovalue. 0 is black, 0.5 the full color, 1 white.COLOR_SATURATE(color, amount): makes the color stronger.COLOR_DESATURATE(color, amount): makes the color paler.COLOR_SATURATION(color, value): sets the saturation tovalue, from 0 (gray) to 1 (full).COLOR_GRAYSCALE(color): turns the color into a gray.COLOR_WHITEN(color, amount): raises the share of white.COLOR_BLACKEN(color, amount): raises the share of black.
Hue, channels and opacity:
COLOR_ROTATE(color, degrees): turns the hue bydegreeson the color wheel.180gives the opposite color.COLOR_NEGATE(color): inverts the color. White becomes black.COLOR_RED(color, value),COLOR_GREEN(color, value),COLOR_BLUE(color, value): set the red, green or blue part tovalue, from 0 to 255.COLOR_FADE(color, amount): makes the color more transparent.0.5halves its opacity.COLOR_OPAQUE(color, amount): makes a transparent color more opaque.
Values from a color:
COLOR_CONTRAST(color1, color2): the contrast between two colors, from 1 (same lightness) to 21 (black on white).COLOR_IS_DARK(color): true if the color is dark.COLOR_IS_LIGHT(color): true if the color is light.COLOR_WHITE(color): the share of white in the color, from 0 to 100.COLOR_BLACK(color): the share of black in the color, from 0 to 100.
Example: IF(COLOR_IS_DARK(brandColor), `#ffffff`, `#000000`) makes a text on a dark brand color white, otherwise black.
Animation
Values that change over time in a video. The current time in seconds is in the value TIME. You find it in the Variables tab.
ANIMATE(time, keyframe1, keyframe2, …): works out the value at the momenttimefrom the keyframes. Fortimeyou useTIME, the time variable of the video. Before the first keyframe, its value applies. After the last one, the value of the last one applies.LINEAR(time, value): a keyframe. At the momenttime, the property has the valuevalue. From the previous keyframe up to this one, it changes evenly.CUBIC(time, value, x1, y1, x2, y2): a keyframe with a curved transition.x1,y1,x2andy2are the two control points of the curve.x1andx2lie between 0 and 1.
Example: ANIMATE(TIME, LINEAR(0, 0), LINEAR(1, 100)) rises from 0 to 100 in the first second.