Skip to main content
All CollectionsThe Expression Editor
Functions in the Expression Editor
Functions in the Expression Editor
Updated over a week ago

.toggle(variable/property)

This function returns the inverse of a boolean value. It toggles between True and False.

.childAtIndex(parent, index)

This function uses an index number to target a specific child within a parent stack.

Note: index values start at 0, not 1.

.asText(object)

This function lets you cast (treat) an object as a text element so that you can access text properties for the object.

.asImage(object)

This function lets you cast (treat) an object as an image element so that you can access image properties for the object.

.asComponent(object)

This function lets you cast (treat) an instance of a component as a component so that you can access the states and variables of the component.

.stringCount(string)

This function returns the number of characters in a given string.

.stringWidth(object, string)

This function returns the width of a string based on the style of the targeted text element.

.substring(string, fromIndex, toIndex)

This function returns a selected range of characters within a given string.

.abs(number)

This function returns the number’s absolute value, which means its distance from zero. It always returns a positive number.

.min(number1, number 2)

This function returns the smaller of the two values.

.max(number1, number 2)

This function returns the larger of the two values.

.pow(number1, number2)

This function returns the value of a decimal raised to a given power.

Note: the decimal and power can both be any integer or decimal value

.squareRoot(number)

This function returns the square root of the given number.

.random(number1, number 2)

This function returns a random number between the two values.

Note: the value can include endpoints

.randomInt(number1, number 2)

This function returns a random integer between the two values.

Note: the value can include endpoints

.round(number)

This function returns the number rounded to the nearest whole number.

.roundUp(number)

This function returns the number rounded up to the nearest whole number.

.roundDown(number)

This function returns a given number rounded down to the nearest whole number.

.roundTo(number)

.formatNumber(number)

.cos(number)

This function returns the cosine of a given number.

.sin(number)

This function returns the sine of a given number.

.tan(number)

This function returns the tangent of a given number.

.atan2(number)

This function returns the arctangent of a given number.

.pi

This function returns pi.

.hypotenuse(length, base)

This function returns the hypotenuse (longest side) of a triangle with a given length and base.

.rgba(red, blue, green, alpha)

This function returns a color.

.hex(hexCode)

This function returns a color.

.blendColor(rgba, rgba, ratio)

This function blends two colors based on a given percentage.

Note: percentage should be written as a decimal between 0 and 1

.valueBetween(number1, number2, percent, overshoot)

The function returns a number between the two values based on a given percentage.

.distance(X1, Y1, X2, Y2)

This function returns the distance between two points, defined by their X & Y locations.

.unsplash(keyword)

This function returns a random image from Unsplash based on a keyword.

Note: this function should be used to target images

.imageShuffle()

This function returns a random image from the project’s assets.

.placeholder(category)

This function returns a random string based on a category:

  • CTA

  • Name

  • Date

  • Address

  • City

  • Short Headline

  • Long Headline

  • Paragraph

  • Multi-Paragraph

.textShuffle()

This function returns a random string based on the category.

.number(String)

This function converts a number to a string.

Note: it does not write the number, use a Format Number action for that.

.snapshot(number)

Takes a snapshot of the target view.

.timeSince1970()

This function returns the time between now & 00:00:00 UTC on January 1st, 1970.

.currentMediaTime()

Returns the current absolute time in seconds.

Did this answer your question?