To allow structured and clean functionalities, the library offers various component types to define properties like color, positions, rotations or behaviour over time. They are all exported into the
Allows the representation of colors through RGB components.
As seen above, colors can be mixed together (with an optional weight). Note that this will create a new object, instead of modifying one of the components.
Additionally, conversion from and to hexadecimal notation are supported, as well as conversion from HSL.
Allows the representation of things like location and rotation through XYZ components.
Vector class has various arithmetic vector math operations defined. Note that these always return a new vector, instead of altering an existing one.
You can also create a 2D vector from a 2D angle. Note that a 90° angle will return (0, 1) correctly, but will point downwards in the DOM.
Geometry components are usually used to define source sampler areas.
A simple rectangle with a position and size.
A simple circle with a position and radius.
The library provides an abstract implementation of a spline, from which more specific implemenations stem. The basic concept is that a spline consists of spline keys, with a time and a value of an arbitrary type. Splines can be created through the constructor of the specific implementation, as seen further below.
A basic implementation of a numeric spline, with easing applied through cosine interpolation.
In this implementation, the values of the spline keys consist of colors, which are mixed together to ease between them. The implementation also offers static utility methods to easily create gradients.