ThemeStore Store Docs FAQ
Documentation

Formula functions

Every function a formula can call. Generated from the launcher's own catalogue.

On this page

Arguments are formulas themselves, so functions nest. Text arguments are quoted with single quotes: format(time_hour, '00').

Like the variables, this table is generated from the app's catalogue and kept in step with it by a test.

Logic#

NameTypeWhat it is
if(condition, then, else)textPicks one of two values. The ? : operator does the same and reads better in short expressions.

Maths#

NameTypeWhat it is
clamp(value, min, max)numberKeeps a value inside a range. The workhorse of animation formulas — almost every fade ends in a clamp.
lerp(from, to, fraction)numberBlends linearly between two numbers; fraction 0 gives from, 1 gives to.
min(a, b)numberThe smaller of two numbers.
max(a, b)numberThe larger of two numbers.
abs(value)numberDistance from zero, dropping the sign.
round(value)numberNearest whole number.
floor(value)numberRounds down.
ceil(value)numberRounds up.
mod(a, b)numberRemainder of a division. Good for repeating patterns across an index.
pow(base, exponent)numberRaises a number to a power.
sqrt(value)numberSquare root.
exp(value)numbere raised to the value. Used for exponential falloff, e.g. the wave in a scrub list.
log(value)numberNatural logarithm.
sin(radians)numberSine. Angles are radians, so a full turn is 2 * pi.
cos(radians)numberCosine.
tan(radians)numberTangent.

Text#

NameTypeWhat it is
format(number, '00')textFormats a number with a pattern. format(time_minute, '00') is what turns 7 into "07".
length(text)numberNumber of characters.
lower(text)textLowercase.
upper(text)textUppercase.
trim(text)textRemoves leading and trailing whitespace.
contains(text, part)yes/noTrue when part occurs anywhere in text.
startsWith(text, prefix)yes/noTrue when the text begins with the prefix.
endsWith(text, suffix)yes/noTrue when the text ends with the suffix.

Colour#

NameTypeWhat it is
color_mix('#000', '#fff', fraction)colourBlends two colours. Fraction 0 gives the first, 1 the second.

Animation#

NameTypeWhat it is
animate([1, 1.05, 1], 2000, true)numberRuns through a list of numbers over a duration in milliseconds; the third argument repeats it. A self-driving value — it changes without anything else changing.
spring(target, stiffness, damping)numberFollows a target with spring physics, so a value that jumps arrives softly.

Operators#

Not functions, but part of the same language:

OperatorMeaning
+ - * /Arithmetic.
== != < <= > >=Comparison.
&& || !Logic.
? :Conditional, a ? b : c.
??Fall back when the left side is empty.

Documentation for launcher 0.1.0-alpha Android 12 and later last updated