Formula functions

Functions and constants every formula can use without importing anything. Angles are in radians unless a property says degrees.

sin(x)#

Sine of an angle in radians: a smooth wave between -1 and 1. sin(time) swings once every 2·PI seconds.

cos(x)#

Cosine of an angle in radians: the same wave as sin, a quarter turn ahead.

abs(x)#

The number without its sign: abs(-3) is 3.

min(a, b, …)#

The smallest of the numbers you pass.

max(a, b, …)#

The largest of the numbers you pass.

round(x)#

The nearest whole number; halves go up.

floor(x)#

The whole number at or below x: floor(2.9) is 2.

ceil(x)#

The whole number at or above x: ceil(2.1) is 3.

clamp(val, lo, hi)#

val kept between lo and hi: below lo gives lo, above hi gives hi.

lerp(a, b, t)#

The point a share t of the way from a to b: t = 0 gives a, t = 1 gives b, 0.5 the middle.

distance(A, B)#

Straight-line distance in pixels between the positions (x, y) of two nodes, the mouse or the parent.

delay(expr, ms)#

What expr was ms milliseconds ago, so something can follow another thing with a lag. At most 10000 ms.

PI3.14159...#

Half a turn in radians (180°).

E2.71828...#

Euler's number, the base of natural logarithms.

Formo

The browser studio where drawings become animations, toys, and games. Your files, nothing to install.