@tsparticles/move-base
Advanced tools
Comparing version 3.0.0-beta.0 to 3.0.0-beta.1
import { getDistance, getRangeMax, getRangeValue, } from "@tsparticles/engine"; | ||
import { applyDistance, getProximitySpeedFactor, move, spin } from "./Utils"; | ||
import { applyDistance, getProximitySpeedFactor, move, spin } from "./Utils.js"; | ||
const diffFactor = 2; | ||
@@ -4,0 +4,0 @@ export class BaseMover { |
@@ -1,4 +0,4 @@ | ||
import { BaseMover } from "./BaseMover"; | ||
import { BaseMover } from "./BaseMover.js"; | ||
export async function loadBaseMover(engine, refresh = true) { | ||
await engine.addMover("base", () => new BaseMover(), refresh); | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Utils_1 = require("./Utils"); | ||
const Utils_js_1 = require("./Utils.js"); | ||
const diffFactor = 2; | ||
@@ -46,13 +46,13 @@ class BaseMover { | ||
} | ||
const container = particle.container, pxRatio = container.retina.pixelRatio, slowFactor = (0, Utils_1.getProximitySpeedFactor)(particle), baseSpeed = (particle.retina.moveSpeed ??= (0, engine_1.getRangeValue)(moveOptions.speed) * pxRatio) * | ||
const container = particle.container, pxRatio = container.retina.pixelRatio, slowFactor = (0, Utils_js_1.getProximitySpeedFactor)(particle), baseSpeed = (particle.retina.moveSpeed ??= (0, engine_1.getRangeValue)(moveOptions.speed) * pxRatio) * | ||
container.retina.reduceFactor, moveDrift = (particle.retina.moveDrift ??= (0, engine_1.getRangeValue)(particle.options.move.drift) * pxRatio), maxSize = (0, engine_1.getRangeMax)(particleOptions.size.value) * pxRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : 1, moveSpeed = (baseSpeed * sizeFactor * slowFactor * (delta.factor || 1)) / diffFactor, maxSpeed = particle.retina.maxSpeed ?? container.retina.maxSpeed; | ||
if (moveOptions.spin.enable) { | ||
(0, Utils_1.spin)(particle, moveSpeed); | ||
(0, Utils_js_1.spin)(particle, moveSpeed); | ||
} | ||
else { | ||
(0, Utils_1.move)(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta); | ||
(0, Utils_js_1.move)(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta); | ||
} | ||
(0, Utils_1.applyDistance)(particle); | ||
(0, Utils_js_1.applyDistance)(particle); | ||
} | ||
} | ||
exports.BaseMover = BaseMover; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadBaseMover = void 0; | ||
const BaseMover_1 = require("./BaseMover"); | ||
const BaseMover_js_1 = require("./BaseMover.js"); | ||
async function loadBaseMover(engine, refresh = true) { | ||
await engine.addMover("base", () => new BaseMover_1.BaseMover(), refresh); | ||
await engine.addMover("base", () => new BaseMover_js_1.BaseMover(), refresh); | ||
} | ||
exports.loadBaseMover = loadBaseMover; |
import { getDistance, getRangeMax, getRangeValue, } from "@tsparticles/engine"; | ||
import { applyDistance, getProximitySpeedFactor, move, spin } from "./Utils"; | ||
import { applyDistance, getProximitySpeedFactor, move, spin } from "./Utils.js"; | ||
const diffFactor = 2; | ||
@@ -4,0 +4,0 @@ export class BaseMover { |
@@ -1,4 +0,4 @@ | ||
import { BaseMover } from "./BaseMover"; | ||
import { BaseMover } from "./BaseMover.js"; | ||
export async function loadBaseMover(engine, refresh = true) { | ||
await engine.addMover("base", () => new BaseMover(), refresh); | ||
} |
{ | ||
"name": "@tsparticles/move-base", | ||
"version": "3.0.0-beta.0", | ||
"version": "3.0.0-beta.1", | ||
"description": "tsParticles Base movement", | ||
@@ -71,10 +71,22 @@ "homepage": "https://particles.js.org", | ||
}, | ||
"main": "cjs/index.js", | ||
"sideEffects": false, | ||
"jsdelivr": "tsparticles.move.base.min.js", | ||
"unpkg": "tsparticles.move.base.min.js", | ||
"browser": "browser/index.js", | ||
"main": "cjs/index.js", | ||
"module": "esm/index.js", | ||
"types": "types/index.d.ts", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"browser": "./browser/index.js", | ||
"import": "./esm/index.js", | ||
"require": "./cjs/index.js", | ||
"umd": "./umd/index.js", | ||
"default": "./cjs/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.0.0-beta.0" | ||
"@tsparticles/engine": "^3.0.0-beta.1" | ||
}, | ||
@@ -81,0 +93,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.0.0-beta.0 | ||
* v3.0.0-beta.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ (function webpackUniversalModuleDefinition(root, factory) { |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Base Move v3.0.0-beta.0 by Matteo Bruni */ | ||
/*! tsParticles Base Move v3.0.0-beta.1 by Matteo Bruni */ |
import { type IDelta, type IParticleMover, type Particle } from "@tsparticles/engine"; | ||
import type { MoveParticle } from "./Types"; | ||
import type { MoveParticle } from "./Types.js"; | ||
export declare class BaseMover implements IParticleMover { | ||
@@ -4,0 +4,0 @@ init(particle: MoveParticle): void; |
@@ -1,3 +0,3 @@ | ||
import type { IParticleGravity } from "./IParticleGravity"; | ||
import type { IParticleSpin } from "./IParticleSpin"; | ||
import type { IParticleGravity } from "./IParticleGravity.js"; | ||
import type { IParticleSpin } from "./IParticleSpin.js"; | ||
import type { Particle } from "@tsparticles/engine"; | ||
@@ -4,0 +4,0 @@ export type MoveParticle = Particle & { |
import { type IDelta, type Move, type Particle } from "@tsparticles/engine"; | ||
import type { MoveParticle } from "./Types"; | ||
import type { MoveParticle } from "./Types.js"; | ||
export declare function applyDistance(particle: MoveParticle): void; | ||
@@ -4,0 +4,0 @@ export declare function move(particle: MoveParticle, moveOptions: Move, moveSpeed: number, maxSpeed: number, moveDrift: number, delta: IDelta): void; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "@tsparticles/engine", "./Utils"], factory); | ||
define(["require", "exports", "@tsparticles/engine", "./Utils.js"], factory); | ||
} | ||
@@ -15,3 +15,3 @@ })(function (require, exports) { | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Utils_1 = require("./Utils"); | ||
const Utils_js_1 = require("./Utils.js"); | ||
const diffFactor = 2; | ||
@@ -56,11 +56,11 @@ class BaseMover { | ||
} | ||
const container = particle.container, pxRatio = container.retina.pixelRatio, slowFactor = (0, Utils_1.getProximitySpeedFactor)(particle), baseSpeed = (particle.retina.moveSpeed ??= (0, engine_1.getRangeValue)(moveOptions.speed) * pxRatio) * | ||
const container = particle.container, pxRatio = container.retina.pixelRatio, slowFactor = (0, Utils_js_1.getProximitySpeedFactor)(particle), baseSpeed = (particle.retina.moveSpeed ??= (0, engine_1.getRangeValue)(moveOptions.speed) * pxRatio) * | ||
container.retina.reduceFactor, moveDrift = (particle.retina.moveDrift ??= (0, engine_1.getRangeValue)(particle.options.move.drift) * pxRatio), maxSize = (0, engine_1.getRangeMax)(particleOptions.size.value) * pxRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : 1, moveSpeed = (baseSpeed * sizeFactor * slowFactor * (delta.factor || 1)) / diffFactor, maxSpeed = particle.retina.maxSpeed ?? container.retina.maxSpeed; | ||
if (moveOptions.spin.enable) { | ||
(0, Utils_1.spin)(particle, moveSpeed); | ||
(0, Utils_js_1.spin)(particle, moveSpeed); | ||
} | ||
else { | ||
(0, Utils_1.move)(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta); | ||
(0, Utils_js_1.move)(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta); | ||
} | ||
(0, Utils_1.applyDistance)(particle); | ||
(0, Utils_js_1.applyDistance)(particle); | ||
} | ||
@@ -67,0 +67,0 @@ } |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./BaseMover"], factory); | ||
define(["require", "exports", "./BaseMover.js"], factory); | ||
} | ||
@@ -14,7 +14,7 @@ })(function (require, exports) { | ||
exports.loadBaseMover = void 0; | ||
const BaseMover_1 = require("./BaseMover"); | ||
const BaseMover_js_1 = require("./BaseMover.js"); | ||
async function loadBaseMover(engine, refresh = true) { | ||
await engine.addMover("base", () => new BaseMover_1.BaseMover(), refresh); | ||
await engine.addMover("base", () => new BaseMover_js_1.BaseMover(), refresh); | ||
} | ||
exports.loadBaseMover = loadBaseMover; | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
337501
40