@tsparticles/path-curl-noise
Version:
tsParticles curl noise path
2 lines (1 loc) • 4.62 kB
JavaScript
!function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-move"),require("@tsparticles/engine"),require("@tsparticles/simplex-noise")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-move","@tsparticles/engine","@tsparticles/simplex-noise"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.paths.curlNoise=s.__tsParticlesInternals.paths.curlNoise||{}),s.__tsParticlesInternals.plugins.move,s.__tsParticlesInternals.engine,s.__tsParticlesInternals.simplex.noise)}(this,function(s,t,e,n){"use strict";const a={speed:.2,step:250};class l{options;#s;#t;#e;constructor(s){this.#s=s,this.#t=e.Vector.origin;const t=new n.SimplexNoise;this.#e=t.noise2d,this.options=e.deepExtend({},a)}generate(s){const t=s.getPosition(),{speed:n,step:a}=this.options,l=t.x/a,r=t.y/a,i=.001,_=(this.#e.noise(l,r+i)-this.#e.noise(l,r-i))/(e.double*i),c=(this.#e.noise(l+i,r)-this.#e.noise(l-i,r))/(e.double*i);return s.velocity.x=0,s.velocity.y=0,this.#t.x=n*_,this.#t.y=n*-c,this.#t}init(){const s=this.#s,t=s.actualOptions.particles.move.path.options;this.options.seed=t.seed,this.options.speed=(t.speed??a.speed)*s.retina.pixelRatio,this.options.step=t.step??a.step,this.#e.seed(this.options.seed??e.getRandom())}reset(){}update(){}}const r="curlNoise";async function i(s){s.checkVersion("4.1.3"),await s.pluginManager.register(s=>{t.ensureBaseMoverLoaded(s),s.pluginManager.addPathGenerator?.(r,s=>Promise.resolve(new l(s)))})}const _=globalThis;_.__tsParticlesInternals=_.__tsParticlesInternals??{},_.loadCurlNoisePath=i,s.curlNoisePathName=r,s.loadCurlNoisePath=i}),Object.assign(globalThis.window||globalThis,{loadCurlNoisePath:(globalThis.__tsParticlesInternals.paths.curlNoise||{}).loadCurlNoisePath}),delete(globalThis.window||globalThis).tsparticlesInternalExports;