Docs: Global functions - Poyo-SSB/osu-playground GitHub Wiki

osu!Playground uses Jint for JavaScript interpretation. Jint has full support for ECMAScript 5.1, notably including the Math object. In addition, a few extra functions are defined by osu!Playground itself.


Properties

Math.PHI

Defined as (1 + sqrt(5)) / 2, known as the "golden ratio," approximately 1.618.

Methods

Math.lerp(v0, v1, t)

Returns the linearly-interpolated value between v0 and v1 by t.

add(a, b)

Adds the Vector2s a and b.

subtract(a, b)

Subtracts the Vector2 b from the Vector2 a.

multiply(a, b)

Multiplies the Vector2s a and b.

divide(a, b)

Divides the Vector2 a by the Vector2 b.

scale(a, b)

Scales the Vector2 a by the number b.

distance(a, b)

Returns the distance between the Vector2 a and the Vector2 b.

rotate(point, around, angle)

Rotates the Vector2 point around the Vector2 around by angle radians.

normalize(v)

Normalizes the Vector2 v to have a length of 1.

lerp(from, to, t)

Returns the linearly-interpolated Vector2 between Vector2 v0 and Vector2 v1 by t.