Skip to main content
Helper Function

Miscellaneous functions that assist in prototyping.

Updated over 2 weeks ago

Overview

These functions are helper functions that help generate content, calculate values, and/or verify something.


Helper Functions

String Split

.stringSplit("string", "separator")

This function splits one string into an array of strings, separated when the separator string is found. The separator is removed.

For example:

.stringSplit("Montana", "n")

Returns the array [mo, ta, a].

Conditional

.conditional(#booleanVariable, value1, value2)

This function returns value 1 if the boolean variable is true or value 2 if the boolean variable is false.

Toggle

.toggle(#variable or property)

This function returns the inverse of the boolean variable or boolean property.

String Contains

.stringContains("string", "contains", caseSensitive)

This function returns true if the target string includes the contains string. Enter a boolean for case sensitive.

Value Between

.valueBetween(number1, number2, percent, overshoot)

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

Distance (Between Points)

.distance(X1, Y1, X2, Y2)

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

Distance (Between Values)

.distance(number, number)

This function returns the distance between two values.

Unsplash

.unsplash(keyword)

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

Note: this function should be used to target images

Image Shuffle

.imageShuffle()

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

Placeholder

.placeholder(category)

This function returns a random string based on a category:

  • CTA

  • Name

  • Date

  • Address

  • City

  • Short Headline

  • Long Headline

  • Paragraph

  • Multi-Paragraph

Text Shuffle

.textShuffle()

This function returns a random string based on the category.

Number

.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

.snapshot(number)

Takes a snapshot of the target view.

Did this answer your question?