Docs: Global functions - lemoncove/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
v0andv1byt.
add(a, b)
Adds the
Vector2saandb.
subtract(a, b)
Subtracts the
Vector2bfrom theVector2a.
multiply(a, b)
Multiplies the
Vector2saandb.
divide(a, b)
Divides the
Vector2aby theVector2b.
scale(a, b)
Scales the
Vector2aby the numberb.
distance(a, b)
Returns the distance between the
Vector2aand theVector2b.
rotate(point, around, angle)
Rotates the
Vector2pointaround theVector2aroundbyangleradians.
normalize(v)
Normalizes the
Vector2vto have a length of 1.
lerp(from, to, t)
Returns the linearly-interpolated
Vector2betweenVector2v0andVector2v1byt.