Splats
Triggering splats
Usage
To trigger multiple random splats accross the canvas call the multipleSplats
method. It has an optional amount
property to set how many splats to trigger.
This will spawn 5 random splats on the canvas.
Specific location
To splat at a specific location you can call the splatAtLocation
method. Where x
and y
are the coordinates in the HTML element where the splat should occur, and dx
and dy
represent the directional components of the splat's force.
This will splat at the center of the canvas with a force of 100 upwards.
The dx
and dy
values are best in the range from -500 to 500, with 0
representing no force
Type Table
Prop | Type | Default |
---|---|---|
x | number | - |
y | number | - |
dx | boolean | - |
dy | number | - |
color | number | generateColor() |
The color
parameter is optional. If not provided, colors from the palette or
then a random color may be used.
Examples
Here are some examples on how you can easily replicate behaviour that was built-in in version 0.6.*
and below.