@tsparticles/updater-orbit
Version:
tsParticles particles orbit updater
17 lines (16 loc) • 653 B
JavaScript
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
const minWidth = 0;
export function drawEllipse(container, context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
if (width <= minWidth) {
return;
}
const pos = particle.getPosition();
if (fillColorValue) {
context.strokeStyle = getStyleFromHsl(fillColorValue, container.hdr, opacity);
}
context.lineWidth = width;
const rotationRadian = degToRad(rotation);
context.beginPath();
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
context.stroke();
}