Skip to main content
Module

x/canvas/mod.ts>Particles

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Latest
interface Particles
implements EmbindObject<Particles>
import { type Particles } from "https://deno.land/x/canvas@v1.4.1/mod.ts";

See SkParticleEffect.h for more details.

Methods

draw(canvas: Canvas): void

Draws the current state of the particles on the given canvas.

uniforms(): Float32Array

Returns a Float32Array bound to the WASM memory of these uniforms. Changing these floats will change the corresponding uniforms instantly.

getUniform(index: number): SkSLUniform

Returns the nth uniform from the effect.

getUniformCount(): number

Returns the number of uniforms on the effect.

getUniformFloatCount(): number

Returns the total number of floats across all uniforms on the effect. This is the length of the array returned by uniforms(). For example, an effect with a single float3 uniform, would return 1 from getUniformCount(), but 3 from getUniformFloatCount().

getUniformName(index: number): string

Returns the name of the nth effect uniform.

setPosition(point: InputPoint): void

Sets the base position of the effect.

setRate(rate: number): void

Sets the base rate of the effect.

start(now: number, looping: boolean): void

Starts playing the effect.

update(now: number): void

Updates the effect using the new time.