@tsparticles/shape-circle
Version:
tsParticles circle shape
24 lines (23 loc) • 680 B
JavaScript
import { degToRad, isObject } from "@tsparticles/engine";
import { drawCircle } from "./Utils.js";
const sides = 12, maxAngle = 360, minAngle = 0;
export class CircleDrawer {
draw(data) {
drawCircle(data);
}
getSidesCount() {
return sides;
}
particleInit(_container, particle) {
const shapeData = particle.shapeData, angle = shapeData?.angle ?? {
max: maxAngle,
min: minAngle,
};
particle.circleRange = isObject(angle)
? { min: degToRad(angle.min), max: degToRad(angle.max) }
: {
min: minAngle,
max: degToRad(angle),
};
}
}