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.

13 lines (12 loc) 303 B
const fixFactor = Math.sqrt(2); /** * @category Shape Drawers */ export class SquareDrawer { getSidesCount() { return 4; } draw(context, particle, radius) { context.rect(-radius / fixFactor, -radius / fixFactor, (radius * 2) / fixFactor, (radius * 2) / fixFactor); } }