UNPKG

tsparticles

Version:

Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.

23 lines (22 loc) 837 B
import { PolygonDrawerBase } from "./PolygonDrawerBase"; export class PolygonDrawer extends PolygonDrawerBase { getSidesData(particle, radius) { var _a, _b; const polygon = particle.shapeData; const sides = (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5; return { count: { denominator: 1, numerator: sides, }, length: (radius * 2.66) / (sides / 3), }; } getCenter(particle, radius) { const sides = this.getSidesCount(particle); return { x: -radius / (sides / 3.5), y: -radius / (2.66 / 3.5), }; } }