2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
/*! For license information please see tsparticles.updater.angle.min.js.LICENSE.txt */
|
|
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],t);else{var o="object"==typeof exports?t(require("tsparticles-engine")):t(e.window);for(var a in o)("object"==typeof exports?exports:e)[a]=o[a]}}(this,(e=>(()=>{"use strict";var t={961:t=>{t.exports=e}},o={};function a(e){var n=o[e];if(void 0!==n)return n.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.d=(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{a.r(n),a.d(n,{loadAngleUpdater:()=>r});var e=a(961);class t{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=(0,e.setRangeValue)(t.speed)),void 0!==t.decay&&(this.decay=(0,e.setRangeValue)(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class o extends e.ValueWithRandom{constructor(){super(),this.animation=new t,this.direction="clockwise",this.path=!1,this.value=0}load(e){e&&(super.load(e),void 0!==e.direction&&(this.direction=e.direction),this.animation.load(e.animation),void 0!==e.path&&(this.path=e.path))}}class i{constructor(e){this.container=e}init(t){const o=t.options.rotate;if(!o)return;t.rotate={enable:o.animation.enable,value:(0,e.getRangeValue)(o.value)*Math.PI/180},t.pathRotation=o.path;let a=o.direction;if("random"===a){a=Math.floor(2*(0,e.getRandom)())>0?"counter-clockwise":"clockwise"}switch(a){case"counter-clockwise":case"counterClockwise":t.rotate.status="decreasing";break;case"clockwise":t.rotate.status="increasing"}const n=o.animation;n.enable&&(t.rotate.decay=1-(0,e.getRangeValue)(n.decay),t.rotate.velocity=(0,e.getRangeValue)(n.speed)/360*this.container.retina.reduceFactor,n.sync||(t.rotate.velocity*=(0,e.getRandom)())),t.rotation=t.rotate.value}isEnabled(e){const t=e.options.rotate;return!!t&&(!e.destroyed&&!e.spawning&&t.animation.enable&&!t.path)}loadOptions(e,...t){e.rotate||(e.rotate=new o);for(const o of t)e.rotate.load(null==o?void 0:o.rotate)}update(e,t){var o,a;this.isEnabled(e)&&(!function(e,t){var o,a;const n=e.rotate,i=e.options.rotate;if(!n||!i)return;const r=i.animation,s=(null!==(o=n.velocity)&&void 0!==o?o:0)*t.factor,c=2*Math.PI,l=null!==(a=n.decay)&&void 0!==a?a:1;r.enable&&("increasing"===n.status?(n.value+=s,n.value>c&&(n.value-=c)):(n.value-=s,n.value<0&&(n.value+=c)),n.velocity&&1!==l&&(n.velocity*=l))}(e,t),e.rotation=null!==(a=null===(o=e.rotate)||void 0===o?void 0:o.value)&&void 0!==a?a:0)}}async function r(e){await e.addParticleUpdater("rotate",(e=>new i(e)))}})(),n})())); |