tsparticles
Version:
Porting of the abandoned Vincent Garreau's particles.js, converted in TypeScript. Added many new cool features and various bug fixes.
19 lines (18 loc) • 476 B
JavaScript
export class ShapeUtils {
static addShapeDrawer(type, drawer) {
if (!this.drawers[type]) {
this.drawers[type] = drawer;
}
}
static drawShape(context, particle, radius, opacity) {
if (!particle.shape) {
return;
}
const drawer = this.drawers[particle.shape];
if (!drawer) {
return;
}
drawer.draw(context, particle, radius, opacity);
}
}
ShapeUtils.drawers = {};