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
andv1
byt
.
add(a, b)
Adds the
Vector2
sa
andb
.
subtract(a, b)
Subtracts the
Vector2
b
from theVector2
a
.
multiply(a, b)
Multiplies the
Vector2
sa
andb
.
divide(a, b)
Divides the
Vector2
a
by theVector2
b
.
scale(a, b)
Scales the
Vector2
a
by the numberb
.
distance(a, b)
Returns the distance between the
Vector2
a
and theVector2
b
.
rotate(point, around, angle)
Rotates the
Vector2
point
around theVector2
around
byangle
radians.
normalize(v)
Normalizes the
Vector2
v
to have a length of 1.
lerp(from, to, t)
Returns the linearly-interpolated
Vector2
betweenVector2
v0
andVector2
v1
byt
.