@tsparticles/path-polygon
Version:
tsParticles polygon path
2 lines (1 loc) • 4.87 kB
JavaScript
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/plugin-move"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-move","@tsparticles/engine"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.paths.polygon=t.__tsParticlesInternals.paths.polygon||{}),t.__tsParticlesInternals.plugins.move,t.__tsParticlesInternals.engine)}(this,function(t,s,e){"use strict";const n={sides:6,turnSteps:20,angle:30};class a{dirsList;options;#t;#s;constructor(t){this.#t=t,this.#s=e.Vector.origin,this.dirsList=[],this.options=e.deepExtend({},n)}generate(t){const{sides:s,turnSteps:n}=this.options;t.hexStep??=0,t.hexDirection??=6===s?2*(3*e.getRandom()|0):e.getRandom()*s|0,t.hexSpeed??=t.velocity.length,t.hexStep%n===0&&(t.hexDirection=e.getRandom()>.5?(t.hexDirection+1)%s:(t.hexDirection+s-1)%s),t.velocity.x=0,t.velocity.y=0,t.hexStep++;const a=this.dirsList[t.hexDirection];return this.#s.x=a.x*t.hexSpeed,this.#s.y=a.y*t.hexSpeed,this.#s}init(){const t=this.#t.actualOptions.particles.move.path.options;this.options.sides=t.sides>0?t.sides:this.options.sides,this.options.angle=t.angle??this.options.angle,this.options.turnSteps=t.turnSteps>=0?t.turnSteps:this.options.turnSteps,this.#e()}reset(t){delete t.hexStep,delete t.hexDirection,delete t.hexSpeed}update(){}#e=()=>{const t=this.options;this.dirsList=[];for(let s=0;s<360;s+=360/t.sides){const n=t.angle+s;this.dirsList.push(e.Vector.create(Math.cos(n*Math.PI/180),Math.sin(n*Math.PI/180)))}}}const r="polygonPathGenerator";async function l(t){t.checkVersion("4.1.0"),await t.pluginManager.register(t=>{s.ensureBaseMoverLoaded(t),t.pluginManager.addPathGenerator?.(r,t=>Promise.resolve(new a(t)))})}const i=globalThis;i.__tsParticlesInternals=i.__tsParticlesInternals??{},i.loadPolygonPath=l,t.loadPolygonPath=l,t.polygonPathName=r}),Object.assign(globalThis.window||globalThis,{loadPolygonPath:(globalThis.__tsParticlesInternals.paths.polygon||{}).loadPolygonPath}),delete(globalThis.window||globalThis).tsparticlesInternalExports;