@tsparticles/updater-orbit
Version:
tsParticles particles orbit updater
30 lines (29 loc) • 1.2 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawEllipse = drawEllipse;
const engine_1 = require("@tsparticles/engine");
const minWidth = 0, half = 0.5, double = 2;
function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
if (width <= minWidth) {
return;
}
const pos = particle.getPosition();
if (fillColorValue) {
context.strokeStyle = (0, engine_1.getStyleFromHsl)(fillColorValue, opacity);
}
context.lineWidth = width;
const rotationRadian = (0, engine_1.degToRad)(rotation);
context.beginPath();
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
context.stroke();
}
});