Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/updater-roll

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/updater-roll - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

4

browser/index.js

@@ -0,6 +1,8 @@

import { assertValidVersion } from "@tsparticles/engine";
import { RollUpdater } from "./RollUpdater.js";
export async function loadRollUpdater(engine, refresh = true) {
assertValidVersion(engine, "3.7.0");
await engine.addParticleUpdater("roll", () => {
return Promise.resolve(new RollUpdater());
return Promise.resolve(new RollUpdater(engine));
}, refresh);
}
import { initParticle, updateRoll } from "./Utils.js";
import { Roll } from "./Options/Classes/Roll.js";
export class RollUpdater {
constructor(engine) {
this._engine = engine;
}
getTransformValues(particle) {

@@ -12,3 +15,3 @@ const roll = particle.roll?.enable && particle.roll, rollHorizontal = roll && roll.horizontal, rollVertical = roll && roll.vertical;

init(particle) {
initParticle(particle);
initParticle(this._engine, particle);
}

@@ -15,0 +18,0 @@ isEnabled(particle) {

@@ -1,5 +0,5 @@

import { AlterType, getRandom, getRangeValue, halfRandom, rangeColorToHsl } from "@tsparticles/engine";
import { AlterType, getRandom, getRangeValue, halfRandom, rangeColorToHsl, } from "@tsparticles/engine";
import { RollMode } from "./RollMode.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360;
export function initParticle(particle) {
export function initParticle(engine, particle) {
const rollOpt = particle.options.roll;

@@ -24,3 +24,3 @@ if (!rollOpt?.enable) {

if (rollOpt.backColor) {
particle.backColor = rangeColorToHsl(rollOpt.backColor);
particle.backColor = rangeColorToHsl(engine, rollOpt.backColor);
}

@@ -27,0 +27,0 @@ else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadRollUpdater = loadRollUpdater;
const engine_1 = require("@tsparticles/engine");
const RollUpdater_js_1 = require("./RollUpdater.js");
async function loadRollUpdater(engine, refresh = true) {
(0, engine_1.assertValidVersion)(engine, "3.7.0");
await engine.addParticleUpdater("roll", () => {
return Promise.resolve(new RollUpdater_js_1.RollUpdater());
return Promise.resolve(new RollUpdater_js_1.RollUpdater(engine));
}, refresh);
}

@@ -7,2 +7,5 @@ "use strict";

class RollUpdater {
constructor(engine) {
this._engine = engine;
}
getTransformValues(particle) {

@@ -16,3 +19,3 @@ const roll = particle.roll?.enable && particle.roll, rollHorizontal = roll && roll.horizontal, rollVertical = roll && roll.vertical;

init(particle) {
(0, Utils_js_1.initParticle)(particle);
(0, Utils_js_1.initParticle)(this._engine, particle);
}

@@ -19,0 +22,0 @@ isEnabled(particle) {

@@ -8,3 +8,3 @@ "use strict";

const double = 2, doublePI = Math.PI * double, maxAngle = 360;
function initParticle(particle) {
function initParticle(engine, particle) {
const rollOpt = particle.options.roll;

@@ -29,3 +29,3 @@ if (!rollOpt?.enable) {

if (rollOpt.backColor) {
particle.backColor = (0, engine_1.rangeColorToHsl)(rollOpt.backColor);
particle.backColor = (0, engine_1.rangeColorToHsl)(engine, rollOpt.backColor);
}

@@ -32,0 +32,0 @@ else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {

@@ -0,6 +1,8 @@

import { assertValidVersion } from "@tsparticles/engine";
import { RollUpdater } from "./RollUpdater.js";
export async function loadRollUpdater(engine, refresh = true) {
assertValidVersion(engine, "3.7.0");
await engine.addParticleUpdater("roll", () => {
return Promise.resolve(new RollUpdater());
return Promise.resolve(new RollUpdater(engine));
}, refresh);
}
import { initParticle, updateRoll } from "./Utils.js";
import { Roll } from "./Options/Classes/Roll.js";
export class RollUpdater {
constructor(engine) {
this._engine = engine;
}
getTransformValues(particle) {

@@ -12,3 +15,3 @@ const roll = particle.roll?.enable && particle.roll, rollHorizontal = roll && roll.horizontal, rollVertical = roll && roll.vertical;

init(particle) {
initParticle(particle);
initParticle(this._engine, particle);
}

@@ -15,0 +18,0 @@ isEnabled(particle) {

@@ -1,5 +0,5 @@

import { AlterType, getRandom, getRangeValue, halfRandom, rangeColorToHsl } from "@tsparticles/engine";
import { AlterType, getRandom, getRangeValue, halfRandom, rangeColorToHsl, } from "@tsparticles/engine";
import { RollMode } from "./RollMode.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360;
export function initParticle(particle) {
export function initParticle(engine, particle) {
const rollOpt = particle.options.roll;

@@ -24,3 +24,3 @@ if (!rollOpt?.enable) {

if (rollOpt.backColor) {
particle.backColor = rangeColorToHsl(rollOpt.backColor);
particle.backColor = rangeColorToHsl(engine, rollOpt.backColor);
}

@@ -27,0 +27,0 @@ else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {

{
"name": "@tsparticles/updater-roll",
"version": "3.6.0",
"version": "3.7.0",
"description": "tsParticles particles roll updater",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.6.0"
"@tsparticles/engine": "3.7.0"
},

@@ -93,0 +93,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.6.0
* v3.7.0
*/

@@ -68,3 +68,3 @@ /*

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RollUpdater: () => (/* binding */ RollUpdater)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n/* harmony import */ var _Options_Classes_Roll_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Roll.js */ \"./dist/browser/Options/Classes/Roll.js\");\n\n\nclass RollUpdater {\n getTransformValues(particle) {\n const roll = particle.roll?.enable && particle.roll,\n rollHorizontal = roll && roll.horizontal,\n rollVertical = roll && roll.vertical;\n return {\n a: rollHorizontal ? Math.cos(roll.angle) : undefined,\n d: rollVertical ? Math.sin(roll.angle) : undefined\n };\n }\n init(particle) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.initParticle)(particle);\n }\n isEnabled(particle) {\n const roll = particle.options.roll;\n return !particle.destroyed && !particle.spawning && !!roll?.enable;\n }\n loadOptions(options, ...sources) {\n if (!options.roll) {\n options.roll = new _Options_Classes_Roll_js__WEBPACK_IMPORTED_MODULE_1__.Roll();\n }\n for (const source of sources) {\n options.roll.load(source?.roll);\n }\n }\n update(particle, delta) {\n if (!this.isEnabled(particle)) {\n return;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.updateRoll)(particle, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/RollUpdater.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RollUpdater: () => (/* binding */ RollUpdater)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n/* harmony import */ var _Options_Classes_Roll_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Roll.js */ \"./dist/browser/Options/Classes/Roll.js\");\n\n\nclass RollUpdater {\n constructor(engine) {\n this._engine = engine;\n }\n getTransformValues(particle) {\n const roll = particle.roll?.enable && particle.roll,\n rollHorizontal = roll && roll.horizontal,\n rollVertical = roll && roll.vertical;\n return {\n a: rollHorizontal ? Math.cos(roll.angle) : undefined,\n d: rollVertical ? Math.sin(roll.angle) : undefined\n };\n }\n init(particle) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.initParticle)(this._engine, particle);\n }\n isEnabled(particle) {\n const roll = particle.options.roll;\n return !particle.destroyed && !particle.spawning && !!roll?.enable;\n }\n loadOptions(options, ...sources) {\n if (!options.roll) {\n options.roll = new _Options_Classes_Roll_js__WEBPACK_IMPORTED_MODULE_1__.Roll();\n }\n for (const source of sources) {\n options.roll.load(source?.roll);\n }\n }\n update(particle, delta) {\n if (!this.isEnabled(particle)) {\n return;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.updateRoll)(particle, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/RollUpdater.js?");

@@ -79,3 +79,3 @@ /***/ }),

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initParticle: () => (/* binding */ initParticle),\n/* harmony export */ updateRoll: () => (/* binding */ updateRoll)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _RollMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RollMode.js */ \"./dist/browser/RollMode.js\");\n\n\nconst double = 2,\n doublePI = Math.PI * double,\n maxAngle = 360;\nfunction initParticle(particle) {\n const rollOpt = particle.options.roll;\n if (!rollOpt?.enable) {\n particle.roll = {\n enable: false,\n horizontal: false,\n vertical: false,\n angle: 0,\n speed: 0\n };\n return;\n }\n particle.roll = {\n enable: rollOpt.enable,\n horizontal: rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.horizontal || rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.both,\n vertical: rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.vertical || rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.both,\n angle: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * doublePI,\n speed: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.speed) / maxAngle\n };\n if (rollOpt.backColor) {\n particle.backColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(rollOpt.backColor);\n } else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {\n const alterType = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.enlighten;\n particle.roll.alter = {\n type: alterType,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(alterType === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken ? rollOpt.darken.value : rollOpt.enlighten.value)\n };\n } else if (rollOpt.darken.enable) {\n particle.roll.alter = {\n type: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.darken.value)\n };\n } else if (rollOpt.enlighten.enable) {\n particle.roll.alter = {\n type: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.enlighten,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.enlighten.value)\n };\n }\n}\nfunction updateRoll(particle, delta) {\n const roll = particle.options.roll,\n data = particle.roll;\n if (!data || !roll?.enable) {\n return;\n }\n const speed = data.speed * delta.factor,\n max = doublePI;\n data.angle += speed;\n if (data.angle > max) {\n data.angle -= max;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/Utils.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initParticle: () => (/* binding */ initParticle),\n/* harmony export */ updateRoll: () => (/* binding */ updateRoll)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _RollMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RollMode.js */ \"./dist/browser/RollMode.js\");\n\n\nconst double = 2,\n doublePI = Math.PI * double,\n maxAngle = 360;\nfunction initParticle(engine, particle) {\n const rollOpt = particle.options.roll;\n if (!rollOpt?.enable) {\n particle.roll = {\n enable: false,\n horizontal: false,\n vertical: false,\n angle: 0,\n speed: 0\n };\n return;\n }\n particle.roll = {\n enable: rollOpt.enable,\n horizontal: rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.horizontal || rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.both,\n vertical: rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.vertical || rollOpt.mode === _RollMode_js__WEBPACK_IMPORTED_MODULE_1__.RollMode.both,\n angle: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * doublePI,\n speed: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.speed) / maxAngle\n };\n if (rollOpt.backColor) {\n particle.backColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(engine, rollOpt.backColor);\n } else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {\n const alterType = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.enlighten;\n particle.roll.alter = {\n type: alterType,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(alterType === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken ? rollOpt.darken.value : rollOpt.enlighten.value)\n };\n } else if (rollOpt.darken.enable) {\n particle.roll.alter = {\n type: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.darken,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.darken.value)\n };\n } else if (rollOpt.enlighten.enable) {\n particle.roll.alter = {\n type: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AlterType.enlighten,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rollOpt.enlighten.value)\n };\n }\n}\nfunction updateRoll(particle, delta) {\n const roll = particle.options.roll,\n data = particle.roll;\n if (!data || !roll?.enable) {\n return;\n }\n const speed = data.speed * delta.factor,\n max = doublePI;\n data.angle += speed;\n if (data.angle > max) {\n data.angle -= max;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/Utils.js?");

@@ -90,3 +90,3 @@ /***/ }),

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRollUpdater: () => (/* binding */ loadRollUpdater)\n/* harmony export */ });\n/* harmony import */ var _RollUpdater_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RollUpdater.js */ \"./dist/browser/RollUpdater.js\");\n\nasync function loadRollUpdater(engine, refresh = true) {\n await engine.addParticleUpdater(\"roll\", () => {\n return Promise.resolve(new _RollUpdater_js__WEBPACK_IMPORTED_MODULE_0__.RollUpdater());\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRollUpdater: () => (/* binding */ loadRollUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _RollUpdater_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RollUpdater.js */ \"./dist/browser/RollUpdater.js\");\n\n\nasync function loadRollUpdater(engine, refresh = true) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.assertValidVersion)(engine, \"3.7.0\");\n await engine.addParticleUpdater(\"roll\", () => {\n return Promise.resolve(new _RollUpdater_js__WEBPACK_IMPORTED_MODULE_1__.RollUpdater(engine));\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-roll/./dist/browser/index.js?");

@@ -93,0 +93,0 @@ /***/ }),

/*! For license information please see tsparticles.updater.roll.min.js.LICENSE.txt */
!function(e,l){if("object"==typeof exports&&"object"==typeof module)module.exports=l(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],l);else{var o="object"==typeof exports?l(require("@tsparticles/engine")):l(e.window);for(var t in o)("object"==typeof exports?exports:e)[t]=o[t]}}(this,(e=>(()=>{var l={303:l=>{l.exports=e}},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return l[e](a,a.exports,t),a.exports}t.d=(e,l)=>{for(var o in l)t.o(l,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:l[o]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};t.r(n),t.d(n,{loadRollUpdater:()=>p});var a,r=t(303);!function(e){e.both="both",e.horizontal="horizontal",e.vertical="vertical"}(a||(a={}));const i=2*Math.PI;class s{constructor(){this.enable=!1,this.value=0}load(e){(0,r.isNull)(e)||(void 0!==e.enable&&(this.enable=e.enable),void 0!==e.value&&(this.value=(0,r.setRangeValue)(e.value)))}}class d{constructor(){this.darken=new s,this.enable=!1,this.enlighten=new s,this.mode=a.vertical,this.speed=25}load(e){(0,r.isNull)(e)||(void 0!==e.backColor&&(this.backColor=r.OptionsColor.create(this.backColor,e.backColor)),this.darken.load(e.darken),void 0!==e.enable&&(this.enable=e.enable),this.enlighten.load(e.enlighten),void 0!==e.mode&&(this.mode=e.mode),void 0!==e.speed&&(this.speed=(0,r.setRangeValue)(e.speed)))}}class c{getTransformValues(e){const l=e.roll?.enable&&e.roll,o=l&&l.horizontal,t=l&&l.vertical;return{a:o?Math.cos(l.angle):void 0,d:t?Math.sin(l.angle):void 0}}init(e){!function(e){const l=e.options.roll;if(l?.enable)if(e.roll={enable:l.enable,horizontal:l.mode===a.horizontal||l.mode===a.both,vertical:l.mode===a.vertical||l.mode===a.both,angle:(0,r.getRandom)()*i,speed:(0,r.getRangeValue)(l.speed)/360},l.backColor)e.backColor=(0,r.rangeColorToHsl)(l.backColor);else if(l.darken.enable&&l.enlighten.enable){const o=(0,r.getRandom)()>=r.halfRandom?r.AlterType.darken:r.AlterType.enlighten;e.roll.alter={type:o,value:(0,r.getRangeValue)(o===r.AlterType.darken?l.darken.value:l.enlighten.value)}}else l.darken.enable?e.roll.alter={type:r.AlterType.darken,value:(0,r.getRangeValue)(l.darken.value)}:l.enlighten.enable&&(e.roll.alter={type:r.AlterType.enlighten,value:(0,r.getRangeValue)(l.enlighten.value)});else e.roll={enable:!1,horizontal:!1,vertical:!1,angle:0,speed:0}}(e)}isEnabled(e){const l=e.options.roll;return!e.destroyed&&!e.spawning&&!!l?.enable}loadOptions(e,...l){e.roll||(e.roll=new d);for(const o of l)e.roll.load(o?.roll)}update(e,l){this.isEnabled(e)&&function(e,l){const o=e.options.roll,t=e.roll;if(!t||!o?.enable)return;const n=t.speed*l.factor,a=i;t.angle+=n,t.angle>a&&(t.angle-=a)}(e,l)}}async function p(e,l=!0){await e.addParticleUpdater("roll",(()=>Promise.resolve(new c)),l)}return n})()));
!function(e,l){if("object"==typeof exports&&"object"==typeof module)module.exports=l(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],l);else{var o="object"==typeof exports?l(require("@tsparticles/engine")):l(e.window);for(var t in o)("object"==typeof exports?exports:e)[t]=o[t]}}(this,(e=>(()=>{var l={303:l=>{l.exports=e}},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return l[e](a,a.exports,t),a.exports}t.d=(e,l)=>{for(var o in l)t.o(l,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:l[o]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};t.r(n),t.d(n,{loadRollUpdater:()=>p});var a,r=t(303);!function(e){e.both="both",e.horizontal="horizontal",e.vertical="vertical"}(a||(a={}));const i=2*Math.PI;class s{constructor(){this.enable=!1,this.value=0}load(e){(0,r.isNull)(e)||(void 0!==e.enable&&(this.enable=e.enable),void 0!==e.value&&(this.value=(0,r.setRangeValue)(e.value)))}}class d{constructor(){this.darken=new s,this.enable=!1,this.enlighten=new s,this.mode=a.vertical,this.speed=25}load(e){(0,r.isNull)(e)||(void 0!==e.backColor&&(this.backColor=r.OptionsColor.create(this.backColor,e.backColor)),this.darken.load(e.darken),void 0!==e.enable&&(this.enable=e.enable),this.enlighten.load(e.enlighten),void 0!==e.mode&&(this.mode=e.mode),void 0!==e.speed&&(this.speed=(0,r.setRangeValue)(e.speed)))}}class c{constructor(e){this._engine=e}getTransformValues(e){const l=e.roll?.enable&&e.roll,o=l&&l.horizontal,t=l&&l.vertical;return{a:o?Math.cos(l.angle):void 0,d:t?Math.sin(l.angle):void 0}}init(e){!function(e,l){const o=l.options.roll;if(o?.enable)if(l.roll={enable:o.enable,horizontal:o.mode===a.horizontal||o.mode===a.both,vertical:o.mode===a.vertical||o.mode===a.both,angle:(0,r.getRandom)()*i,speed:(0,r.getRangeValue)(o.speed)/360},o.backColor)l.backColor=(0,r.rangeColorToHsl)(e,o.backColor);else if(o.darken.enable&&o.enlighten.enable){const e=(0,r.getRandom)()>=r.halfRandom?r.AlterType.darken:r.AlterType.enlighten;l.roll.alter={type:e,value:(0,r.getRangeValue)(e===r.AlterType.darken?o.darken.value:o.enlighten.value)}}else o.darken.enable?l.roll.alter={type:r.AlterType.darken,value:(0,r.getRangeValue)(o.darken.value)}:o.enlighten.enable&&(l.roll.alter={type:r.AlterType.enlighten,value:(0,r.getRangeValue)(o.enlighten.value)});else l.roll={enable:!1,horizontal:!1,vertical:!1,angle:0,speed:0}}(this._engine,e)}isEnabled(e){const l=e.options.roll;return!e.destroyed&&!e.spawning&&!!l?.enable}loadOptions(e,...l){e.roll||(e.roll=new d);for(const o of l)e.roll.load(o?.roll)}update(e,l){this.isEnabled(e)&&function(e,l){const o=e.options.roll,t=e.roll;if(!t||!o?.enable)return;const n=t.speed*l.factor,a=i;t.angle+=n,t.angle>a&&(t.angle-=a)}(e,l)}}async function p(e,l=!0){(0,r.assertValidVersion)(e,"3.7.0"),await e.addParticleUpdater("roll",(()=>Promise.resolve(new c(e))),l)}return n})()));

@@ -1,1 +0,1 @@

/*! tsParticles Roll Updater v3.6.0 by Matteo Bruni */
/*! tsParticles Roll Updater v3.7.0 by Matteo Bruni */

@@ -1,2 +0,2 @@

import type { Engine } from "@tsparticles/engine";
import { type Engine } from "@tsparticles/engine";
export declare function loadRollUpdater(engine: Engine, refresh?: boolean): Promise<void>;

@@ -1,4 +0,6 @@

import { type IDelta, type IParticleTransformValues, type IParticleUpdater, type Particle, type RecursivePartial } from "@tsparticles/engine";
import { type Engine, type IDelta, type IParticleTransformValues, type IParticleUpdater, type Particle, type RecursivePartial } from "@tsparticles/engine";
import type { IRollParticlesOptions, RollParticle, RollParticlesOptions } from "./Types.js";
export declare class RollUpdater implements IParticleUpdater {
private readonly _engine;
constructor(engine: Engine);
getTransformValues(particle: Particle): IParticleTransformValues;

@@ -5,0 +7,0 @@ init(particle: RollParticle): void;

@@ -1,4 +0,4 @@

import { type IDelta } from "@tsparticles/engine";
import { type Engine, type IDelta } from "@tsparticles/engine";
import type { RollParticle } from "./Types.js";
export declare function initParticle(particle: RollParticle): void;
export declare function initParticle(engine: Engine, particle: RollParticle): void;
export declare function updateRoll(particle: RollParticle, delta: IDelta): void;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./RollUpdater.js"], factory);
define(["require", "exports", "@tsparticles/engine", "./RollUpdater.js"], factory);
}

@@ -14,8 +14,10 @@ })(function (require, exports) {

exports.loadRollUpdater = loadRollUpdater;
const engine_1 = require("@tsparticles/engine");
const RollUpdater_js_1 = require("./RollUpdater.js");
async function loadRollUpdater(engine, refresh = true) {
(0, engine_1.assertValidVersion)(engine, "3.7.0");
await engine.addParticleUpdater("roll", () => {
return Promise.resolve(new RollUpdater_js_1.RollUpdater());
return Promise.resolve(new RollUpdater_js_1.RollUpdater(engine));
}, refresh);
}
});

@@ -16,2 +16,5 @@ (function (factory) {

class RollUpdater {
constructor(engine) {
this._engine = engine;
}
getTransformValues(particle) {

@@ -25,3 +28,3 @@ const roll = particle.roll?.enable && particle.roll, rollHorizontal = roll && roll.horizontal, rollVertical = roll && roll.vertical;

init(particle) {
(0, Utils_js_1.initParticle)(particle);
(0, Utils_js_1.initParticle)(this._engine, particle);
}

@@ -28,0 +31,0 @@ isEnabled(particle) {

@@ -17,3 +17,3 @@ (function (factory) {

const double = 2, doublePI = Math.PI * double, maxAngle = 360;
function initParticle(particle) {
function initParticle(engine, particle) {
const rollOpt = particle.options.roll;

@@ -38,3 +38,3 @@ if (!rollOpt?.enable) {

if (rollOpt.backColor) {
particle.backColor = (0, engine_1.rangeColorToHsl)(rollOpt.backColor);
particle.backColor = (0, engine_1.rangeColorToHsl)(engine, rollOpt.backColor);
}

@@ -41,0 +41,0 @@ else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc