@tsparticles/engine 3.0.0-beta.2 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/Core/Canvas.js +2 -2
- package/browser/Core/Container.js +39 -24
- package/browser/Core/Engine.js +26 -53
- package/browser/Core/Particle.js +88 -53
- package/browser/Core/Particles.js +51 -26
- package/browser/Core/Retina.js +0 -2
- package/browser/Core/Utils/QuadTree.js +1 -1
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
- package/browser/Options/Classes/ColorAnimation.js +4 -24
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
- package/browser/Options/Classes/Particles/Effect/Effect.js +32 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
- package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +17 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +2 -3
- package/browser/Options/Classes/Particles/ParticlesOptions.js +3 -0
- package/browser/Options/Classes/Particles/Size/Size.js +2 -3
- package/browser/Options/Classes/ValueWithRandom.js +1 -10
- package/browser/Utils/CanvasUtils.js +29 -21
- package/browser/Utils/ColorUtils.js +24 -38
- package/browser/Utils/NumberUtils.js +7 -16
- package/browser/Utils/Utils.js +13 -7
- package/browser/export-types.js +4 -2
- package/browser/exports.js +2 -3
- package/cjs/Core/Canvas.js +2 -2
- package/cjs/Core/Container.js +39 -24
- package/cjs/Core/Engine.js +25 -52
- package/cjs/Core/Particle.js +87 -52
- package/cjs/Core/Particles.js +51 -26
- package/cjs/Core/Retina.js +0 -2
- package/cjs/Core/Utils/QuadTree.js +1 -1
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
- package/cjs/Options/Classes/ColorAnimation.js +4 -24
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
- package/cjs/Options/Classes/Particles/Effect/Effect.js +36 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +21 -0
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -2
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +3 -0
- package/cjs/Options/Classes/Particles/Size/Size.js +2 -3
- package/cjs/Options/Classes/ValueWithRandom.js +1 -10
- package/cjs/Utils/CanvasUtils.js +32 -24
- package/cjs/Utils/ColorUtils.js +24 -38
- package/cjs/Utils/NumberUtils.js +8 -18
- package/cjs/Utils/Utils.js +14 -7
- package/cjs/export-types.js +4 -2
- package/cjs/exports.js +2 -3
- package/esm/Core/Canvas.js +2 -2
- package/esm/Core/Container.js +39 -24
- package/esm/Core/Engine.js +26 -53
- package/esm/Core/Particle.js +88 -53
- package/esm/Core/Particles.js +51 -26
- package/esm/Core/Retina.js +0 -2
- package/esm/Core/Utils/QuadTree.js +1 -1
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
- package/esm/Options/Classes/ColorAnimation.js +4 -24
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
- package/esm/Options/Classes/Particles/Effect/Effect.js +32 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
- package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +17 -0
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +2 -3
- package/esm/Options/Classes/Particles/ParticlesOptions.js +3 -0
- package/esm/Options/Classes/Particles/Size/Size.js +2 -3
- package/esm/Options/Classes/ValueWithRandom.js +1 -10
- package/esm/Utils/CanvasUtils.js +29 -21
- package/esm/Utils/ColorUtils.js +24 -38
- package/esm/Utils/NumberUtils.js +7 -16
- package/esm/Utils/Utils.js +13 -7
- package/esm/export-types.js +4 -2
- package/esm/exports.js +2 -3
- package/package.json +1 -1
- package/report.html +4 -22
- package/tsparticles.engine.js +461 -347
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +0 -1
- package/types/Core/Container.d.ts +9 -8
- package/types/Core/Engine.d.ts +9 -5
- package/types/Core/Interfaces/IContainerPlugin.d.ts +2 -3
- package/types/Core/Interfaces/IEffectDrawer.d.ts +10 -0
- package/types/Core/Interfaces/IExternalInteractor.d.ts +3 -4
- package/types/Core/Interfaces/IInteractor.d.ts +3 -3
- package/types/Core/Interfaces/IParticleRetinaProps.d.ts +0 -1
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +3 -3
- package/types/Core/Interfaces/IShapeDrawData.d.ts +10 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +11 -9
- package/types/Core/Particle.d.ts +7 -5
- package/types/Core/Particles.d.ts +10 -7
- package/types/Core/Retina.d.ts +0 -1
- package/types/Core/Utils/ExternalInteractorBase.d.ts +4 -4
- package/types/Core/Utils/InteractionManager.d.ts +1 -2
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +5 -5
- package/types/Enums/Modes/LimitMode.d.ts +4 -0
- package/types/Enums/Types/EasingType.d.ts +3 -0
- package/types/Enums/Types/EventType.d.ts +1 -0
- package/types/Options/Classes/BackgroundMask/BackgroundMask.d.ts +1 -1
- package/types/Options/Classes/ColorAnimation.d.ts +2 -7
- package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +1 -2
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +1 -2
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +3 -3
- package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +2 -3
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +2 -2
- package/types/Options/Classes/Options.d.ts +6 -6
- package/types/Options/Classes/Particles/Bounce/ParticlesBounce.d.ts +2 -2
- package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +3 -3
- package/types/Options/Classes/Particles/Effect/Effect.d.ts +13 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +8 -8
- package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +1 -1
- package/types/Options/Classes/Particles/Number/ParticlesNumber.d.ts +3 -2
- package/types/Options/Classes/Particles/Number/ParticlesNumberLimit.d.ts +10 -0
- package/types/Options/Classes/Particles/Opacity/Opacity.d.ts +3 -3
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +12 -10
- package/types/Options/Classes/Particles/Size/Size.d.ts +3 -3
- package/types/Options/Classes/Theme/Theme.d.ts +1 -1
- package/types/Options/Classes/ValueWithRandom.d.ts +2 -4
- package/types/Options/Interfaces/IValueWithRandom.d.ts +0 -2
- package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +1 -2
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +1 -2
- package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +1 -2
- package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +8 -0
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -0
- package/types/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +2 -1
- package/types/Options/Interfaces/Particles/Number/IParticlesNumberLimit.d.ts +5 -0
- package/types/Types/CustomEventArgs.d.ts +1 -1
- package/types/Utils/CanvasUtils.d.ts +12 -3
- package/types/Utils/ColorUtils.d.ts +2 -2
- package/types/Utils/NumberUtils.d.ts +0 -2
- package/types/Utils/Utils.d.ts +6 -6
- package/types/export-types.d.ts +5 -2
- package/types/exports.d.ts +2 -3
- package/umd/Core/Canvas.js +2 -2
- package/umd/Core/Container.js +40 -25
- package/umd/Core/Engine.js +25 -52
- package/umd/Core/Particle.js +87 -52
- package/umd/Core/Particles.js +51 -26
- package/umd/Core/Retina.js +0 -2
- package/umd/Core/Utils/QuadTree.js +1 -1
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
- package/umd/Options/Classes/ColorAnimation.js +5 -25
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
- package/umd/Options/Classes/Particles/Effect/Effect.js +46 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +4 -6
- package/umd/Options/Classes/{Random.js → Particles/Number/ParticlesNumberLimit.js} +9 -9
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -2
- package/umd/Options/Classes/Particles/ParticlesOptions.js +4 -1
- package/umd/Options/Classes/Particles/Size/Size.js +3 -4
- package/umd/Options/Classes/ValueWithRandom.js +2 -11
- package/umd/Utils/CanvasUtils.js +32 -24
- package/umd/Utils/ColorUtils.js +24 -38
- package/umd/Utils/NumberUtils.js +9 -19
- package/umd/Utils/Utils.js +14 -7
- package/umd/export-types.js +5 -3
- package/umd/exports.js +3 -4
- package/browser/Options/Classes/Random.js +0 -17
- package/cjs/Options/Classes/Random.js +0 -21
- package/cjs/Types/ShapeDrawerFunctions.js +0 -2
- package/esm/Options/Classes/Random.js +0 -17
- package/esm/Options/Interfaces/IRandom.js +0 -1
- package/esm/Types/ShapeDrawerFunctions.js +0 -1
- package/types/Core/Interfaces/IParticle.d.ts +0 -48
- package/types/Enums/Modes/ClickMode.d.ts +0 -9
- package/types/Enums/Modes/DivMode.d.ts +0 -5
- package/types/Enums/Modes/HoverMode.d.ts +0 -11
- package/types/Options/Classes/Random.d.ts +0 -9
- package/types/Options/Interfaces/IRandom.d.ts +0 -4
- package/types/Types/ShapeDrawerFunctions.d.ts +0 -10
- package/umd/Types/ShapeDrawerFunctions.js +0 -12
- /package/browser/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
- /package/browser/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
- /package/browser/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
- /package/browser/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
- /package/browser/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
- /package/cjs/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
- /package/cjs/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
- /package/cjs/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
- /package/cjs/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
- /package/cjs/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
- /package/{browser/Types/ShapeDrawerFunctions.js → esm/Core/Interfaces/IEffectDrawer.js} +0 -0
- /package/esm/Core/Interfaces/{IParticle.js → IShapeDrawData.js} +0 -0
- /package/esm/Enums/Modes/{ClickMode.js → LimitMode.js} +0 -0
- /package/esm/{Enums/Modes/DivMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
- /package/esm/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Number/IParticlesNumberLimit.js} +0 -0
- /package/umd/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
- /package/umd/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
- /package/umd/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
- /package/umd/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
- /package/umd/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IAnimatableColor } from "../IAnimatableColor.js";
|
|
2
2
|
import type { ICollisions } from "./Collisions/ICollisions.js";
|
|
3
|
+
import type { IEffect } from "./Effect/IEffect.js";
|
|
3
4
|
import type { IInteractivity } from "../Interactivity/IInteractivity.js";
|
|
4
5
|
import type { IMove } from "./Move/IMove.js";
|
|
5
6
|
import type { IOpacity } from "./Opacity/IOpacity.js";
|
|
@@ -18,6 +19,7 @@ export interface IParticlesOptions {
|
|
|
18
19
|
bounce: IParticlesBounce;
|
|
19
20
|
collisions: ICollisions;
|
|
20
21
|
color: IAnimatableColor;
|
|
22
|
+
effect: IEffect;
|
|
21
23
|
groups: ParticlesGroups;
|
|
22
24
|
interactivity?: RecursivePartial<IInteractivity>;
|
|
23
25
|
move: IMove;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IParticlesDensity } from "./IParticlesDensity.js";
|
|
2
|
+
import type { IParticlesNumberLimit } from "./IParticlesNumberLimit.js";
|
|
2
3
|
export interface IParticlesNumber {
|
|
3
4
|
density: IParticlesDensity;
|
|
4
|
-
limit:
|
|
5
|
+
limit: IParticlesNumberLimit;
|
|
5
6
|
value: number;
|
|
6
7
|
}
|
|
@@ -8,13 +8,22 @@ import type { IDrawParticleParams } from "../Core/Interfaces/IDrawParticleParams
|
|
|
8
8
|
import type { IHsl } from "../Core/Interfaces/Colors.js";
|
|
9
9
|
import type { Particle } from "../Core/Particle.js";
|
|
10
10
|
export declare function drawLine(context: CanvasRenderingContext2D, begin: ICoordinates, end: ICoordinates): void;
|
|
11
|
-
export declare function drawTriangle(context: CanvasRenderingContext2D, p1: ICoordinates, p2: ICoordinates, p3: ICoordinates): void;
|
|
12
11
|
export declare function paintBase(context: CanvasRenderingContext2D, dimension: IDimension, baseColor?: string): void;
|
|
13
12
|
export declare function paintImage(context: CanvasRenderingContext2D, dimension: IDimension, image: HTMLImageElement | undefined, opacity: number): void;
|
|
14
13
|
export declare function clear(context: CanvasRenderingContext2D, dimension: IDimension): void;
|
|
15
14
|
export declare function drawParticle(data: IDrawParticleParams): void;
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
type DrawShapeData = {
|
|
16
|
+
container: Container;
|
|
17
|
+
context: CanvasRenderingContext2D;
|
|
18
|
+
delta: IDelta;
|
|
19
|
+
opacity: number;
|
|
20
|
+
particle: Particle;
|
|
21
|
+
radius: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function drawEffect(data: DrawShapeData): void;
|
|
24
|
+
export declare function drawShape(data: DrawShapeData): void;
|
|
25
|
+
export declare function drawShapeAfterDraw(data: DrawShapeData): void;
|
|
18
26
|
export declare function drawPlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, delta: IDelta): void;
|
|
19
27
|
export declare function drawParticlePlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, particle: Particle, delta: IDelta): void;
|
|
20
28
|
export declare function alterHsl(color: IHsl, type: AlterType, value: number): IHsl;
|
|
29
|
+
export {};
|
|
@@ -2,8 +2,8 @@ import type { IColor, IHsl, IHsla, IRangeColor, IRgb, IRgba } from "../Core/Inte
|
|
|
2
2
|
import type { HslAnimation } from "../Options/Classes/HslAnimation.js";
|
|
3
3
|
import type { IColorManager } from "../Core/Interfaces/IColorManager.js";
|
|
4
4
|
import type { IOptionsColor } from "../Options/Interfaces/IOptionsColor.js";
|
|
5
|
-
import type { IParticle } from "../Core/Interfaces/IParticle.js";
|
|
6
5
|
import type { IParticleHslAnimation } from "../Core/Interfaces/IParticleHslAnimation.js";
|
|
6
|
+
import type { Particle } from "../Core/Particle.js";
|
|
7
7
|
export declare function addColorManager(manager: IColorManager): void;
|
|
8
8
|
export declare function rangeColorToRgb(input?: string | IRangeColor, index?: number, useIndex?: boolean): IRgb | undefined;
|
|
9
9
|
export declare function colorToRgb(input?: string | IColor, index?: number, useIndex?: boolean): IRgb | undefined;
|
|
@@ -18,7 +18,7 @@ export declare function getRandomRgbColor(min?: number): IRgb;
|
|
|
18
18
|
export declare function getStyleFromRgb(color: IRgb, opacity?: number): string;
|
|
19
19
|
export declare function getStyleFromHsl(color: IHsl, opacity?: number): string;
|
|
20
20
|
export declare function colorMix(color1: IRgb | IHsl, color2: IRgb | IHsl, size1: number, size2: number): IRgb;
|
|
21
|
-
export declare function getLinkColor(p1:
|
|
21
|
+
export declare function getLinkColor(p1: Particle, p2?: Particle, linkColor?: string | IRgb): IRgb | undefined;
|
|
22
22
|
export declare function getLinkRandomColor(optColor: string | IOptionsColor, blink: boolean, consent: boolean): IRgb | string | undefined;
|
|
23
23
|
export declare function getHslFromAnimation(animation?: IParticleHslAnimation): IHsl | undefined;
|
|
24
24
|
export declare function getHslAnimationFromHsl(hsl: IHsl, animationOptions: HslAnimation | undefined, reduceFactor: number): IParticleHslAnimation;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { EasingType, EasingTypeAlt } from "../Enums/Types/EasingType.js";
|
|
2
2
|
import type { IPositionFromSizeParams, IRangedPositionFromSizeParams } from "../Core/Interfaces/IPositionFromSizeParams.js";
|
|
3
3
|
import type { ICoordinates } from "../Core/Interfaces/ICoordinates.js";
|
|
4
|
-
import type { IValueWithRandom } from "../Options/Interfaces/IValueWithRandom.js";
|
|
5
4
|
import { MoveDirection } from "../Enums/Directions/MoveDirection.js";
|
|
6
5
|
import type { MoveDirectionAlt } from "../Enums/Directions/MoveDirection.js";
|
|
7
6
|
import type { RangeValue } from "../Types/RangeValue.js";
|
|
@@ -18,7 +17,6 @@ export declare function getRangeValue(value: RangeValue): number;
|
|
|
18
17
|
export declare function getRangeMin(value: RangeValue): number;
|
|
19
18
|
export declare function getRangeMax(value: RangeValue): number;
|
|
20
19
|
export declare function setRangeValue(source: RangeValue, value?: number): RangeValue;
|
|
21
|
-
export declare function getValue(options: IValueWithRandom): number;
|
|
22
20
|
export declare function getDistances(pointA: ICoordinates, pointB: ICoordinates): {
|
|
23
21
|
distance: number;
|
|
24
22
|
dx: number;
|
package/types/Utils/Utils.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { ICoordinates, ICoordinatesWithMode } from "../Core/Interfaces/ICoordinates.js";
|
|
2
2
|
import type { IDimension, IDimensionWithMode } from "../Core/Interfaces/IDimension.js";
|
|
3
3
|
import type { DivEvent } from "../Options/Classes/Interactivity/Events/DivEvent.js";
|
|
4
|
-
import type { DivMode } from "../Enums/Modes/DivMode.js";
|
|
5
4
|
import type { IBounds } from "../Core/Interfaces/IBounds.js";
|
|
6
5
|
import type { ICircleBouncer } from "../Core/Interfaces/ICircleBouncer.js";
|
|
7
6
|
import type { IModeDiv } from "../Options/Interfaces/Interactivity/Modes/IModeDiv.js";
|
|
8
|
-
import type { IParticle } from "../Core/Interfaces/IParticle.js";
|
|
9
7
|
import type { IParticleNumericValueAnimation } from "../Core/Interfaces/IParticleValueAnimation.js";
|
|
10
8
|
import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js";
|
|
9
|
+
import type { Particle } from "../Core/Particle.js";
|
|
11
10
|
import type { RangedAnimationValueWithRandom } from "../Options/Classes/ValueWithRandom.js";
|
|
12
11
|
import type { SingleOrMultiple } from "../Types/SingleOrMultiple.js";
|
|
13
12
|
interface ILogger {
|
|
@@ -23,6 +22,7 @@ export declare function getLogger(): ILogger;
|
|
|
23
22
|
export declare function isSsr(): boolean;
|
|
24
23
|
export declare function hasMatchMedia(): boolean;
|
|
25
24
|
export declare function safeMatchMedia(query: string): MediaQueryList | undefined;
|
|
25
|
+
export declare function safeIntersectionObserver(callback: (records: IntersectionObserverEntry[]) => void): IntersectionObserver | undefined;
|
|
26
26
|
export declare function safeMutationObserver(callback: (records: MutationRecord[]) => void): MutationObserver | undefined;
|
|
27
27
|
export declare function isInArray<T>(value: T, array: SingleOrMultiple<T>): boolean;
|
|
28
28
|
export declare function loadFont(font?: string, weight?: string): Promise<void>;
|
|
@@ -32,13 +32,13 @@ export declare function isPointInside(point: ICoordinates, size: IDimension, off
|
|
|
32
32
|
export declare function areBoundsInside(bounds: IBounds, size: IDimension, offset: ICoordinates, direction?: OutModeDirection): boolean;
|
|
33
33
|
export declare function calculateBounds(point: ICoordinates, radius: number): IBounds;
|
|
34
34
|
export declare function deepExtend(destination: unknown, ...sources: unknown[]): unknown;
|
|
35
|
-
export declare function isDivModeEnabled(mode:
|
|
36
|
-
export declare function divModeExecute(mode:
|
|
35
|
+
export declare function isDivModeEnabled(mode: string, divs: SingleOrMultiple<DivEvent>): boolean;
|
|
36
|
+
export declare function divModeExecute(mode: string, divs: SingleOrMultiple<DivEvent>, callback: (id: string, div: DivEvent) => void): void;
|
|
37
37
|
export declare function singleDivModeExecute(div: DivEvent, callback: (selector: string, div: DivEvent) => void): void;
|
|
38
38
|
export declare function divMode<T extends IModeDiv>(divs?: SingleOrMultiple<T>, element?: HTMLElement): T | undefined;
|
|
39
|
-
export declare function circleBounceDataFromParticle(p:
|
|
39
|
+
export declare function circleBounceDataFromParticle(p: Particle): ICircleBouncer;
|
|
40
40
|
export declare function circleBounce(p1: ICircleBouncer, p2: ICircleBouncer): void;
|
|
41
|
-
export declare function rectBounce(particle:
|
|
41
|
+
export declare function rectBounce(particle: Particle, divBounds: IBounds): void;
|
|
42
42
|
export declare function executeOnSingleOrMultiple<T, U = void>(obj: SingleOrMultiple<T>, callback: (obj: T, index: number) => U): SingleOrMultiple<U>;
|
|
43
43
|
export declare function itemFromSingleOrMultiple<T>(obj: SingleOrMultiple<T>, index?: number, useIndex?: boolean): T;
|
|
44
44
|
export declare function findItemFromSingleOrMultiple<T>(obj: SingleOrMultiple<T>, callback: (obj: T, index: number) => boolean): T | undefined;
|
package/types/export-types.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ export * from "./Core/Interfaces/IDelta.js";
|
|
|
11
11
|
export * from "./Core/Interfaces/IDimension.js";
|
|
12
12
|
export * from "./Core/Interfaces/IDistance.js";
|
|
13
13
|
export * from "./Core/Interfaces/IDrawParticleParams.js";
|
|
14
|
+
export * from "./Core/Interfaces/IEffectDrawer.js";
|
|
14
15
|
export * from "./Core/Interfaces/IExternalInteractor.js";
|
|
15
16
|
export * from "./Core/Interfaces/IInteractor.js";
|
|
16
17
|
export * from "./Core/Interfaces/ILoadParams.js";
|
|
17
18
|
export * from "./Core/Interfaces/IMouseData.js";
|
|
18
19
|
export * from "./Core/Interfaces/IMovePathGenerator.js";
|
|
19
|
-
export * from "./Core/Interfaces/IParticle.js";
|
|
20
20
|
export * from "./Core/Interfaces/IParticleColorStyle.js";
|
|
21
21
|
export * from "./Core/Interfaces/IParticleHslAnimation.js";
|
|
22
22
|
export * from "./Core/Interfaces/IParticleLife.js";
|
|
@@ -31,6 +31,7 @@ export * from "./Core/Interfaces/IPlugin.js";
|
|
|
31
31
|
export * from "./Core/Interfaces/IPositionFromSizeParams.js";
|
|
32
32
|
export * from "./Core/Interfaces/IRangeValue.js";
|
|
33
33
|
export * from "./Core/Interfaces/IRectSideResult.js";
|
|
34
|
+
export * from "./Core/Interfaces/IShapeDrawData.js";
|
|
34
35
|
export * from "./Core/Interfaces/IShapeDrawer.js";
|
|
35
36
|
export * from "./Core/Interfaces/IShapeValues.js";
|
|
36
37
|
export * from "./Core/Interfaces/ISlowParticleData.js";
|
|
@@ -63,6 +64,7 @@ export * from "./Options/Interfaces/Particles/Bounce/IParticlesBounce.js";
|
|
|
63
64
|
export * from "./Options/Interfaces/Particles/Collisions/ICollisions.js";
|
|
64
65
|
export * from "./Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js";
|
|
65
66
|
export * from "./Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js";
|
|
67
|
+
export * from "./Options/Interfaces/Particles/Effect/IEffect.js";
|
|
66
68
|
export * from "./Options/Interfaces/Particles/IParticlesOptions.js";
|
|
67
69
|
export * from "./Options/Interfaces/Particles/IShadow.js";
|
|
68
70
|
export * from "./Options/Interfaces/Particles/IStroke.js";
|
|
@@ -77,6 +79,7 @@ export * from "./Options/Interfaces/Particles/Move/ISpin.js";
|
|
|
77
79
|
export * from "./Options/Interfaces/Particles/Move/IMoveTrail.js";
|
|
78
80
|
export * from "./Options/Interfaces/Particles/Number/IParticlesDensity.js";
|
|
79
81
|
export * from "./Options/Interfaces/Particles/Number/IParticlesNumber.js";
|
|
82
|
+
export * from "./Options/Interfaces/Particles/Number/IParticlesNumberLimit.js";
|
|
80
83
|
export * from "./Options/Interfaces/Particles/Opacity/IOpacity.js";
|
|
81
84
|
export * from "./Options/Interfaces/Particles/Opacity/IOpacityAnimation.js";
|
|
82
85
|
export * from "./Options/Interfaces/Particles/Shape/IShape.js";
|
|
@@ -94,7 +97,6 @@ export * from "./Types/PathOptions.js";
|
|
|
94
97
|
export * from "./Types/RangeValue.js";
|
|
95
98
|
export * from "./Types/RecursivePartial.js";
|
|
96
99
|
export * from "./Types/ShapeData.js";
|
|
97
|
-
export * from "./Types/ShapeDrawerFunctions.js";
|
|
98
100
|
export * from "./Types/SingleOrMultiple.js";
|
|
99
101
|
export type { EventListeners } from "./Core/Utils/EventListeners.js";
|
|
100
102
|
export type { InteractionManager } from "./Core/Utils/InteractionManager.js";
|
|
@@ -105,3 +107,4 @@ export type { Particle } from "./Core/Particle.js";
|
|
|
105
107
|
export type { Particles } from "./Core/Particles.js";
|
|
106
108
|
export type { Retina } from "./Core/Retina.js";
|
|
107
109
|
export type { Engine, Engine as Main };
|
|
110
|
+
export type { IParticlesNumberLimit } from "./Options/Interfaces/Particles/Number/IParticlesNumberLimit.js";
|
package/types/exports.d.ts
CHANGED
|
@@ -11,10 +11,8 @@ export * from "./Enums/Directions/MoveDirection.js";
|
|
|
11
11
|
export * from "./Enums/Directions/RotateDirection.js";
|
|
12
12
|
export * from "./Enums/Directions/OutModeDirection.js";
|
|
13
13
|
export * from "./Enums/Modes/AnimationMode.js";
|
|
14
|
-
export * from "./Enums/Modes/ClickMode.js";
|
|
15
|
-
export * from "./Enums/Modes/DivMode.js";
|
|
16
|
-
export * from "./Enums/Modes/HoverMode.js";
|
|
17
14
|
export * from "./Enums/Modes/CollisionMode.js";
|
|
15
|
+
export * from "./Enums/Modes/LimitMode.js";
|
|
18
16
|
export * from "./Enums/Modes/OutMode.js";
|
|
19
17
|
export * from "./Enums/Modes/PixelMode.js";
|
|
20
18
|
export * from "./Enums/Modes/ThemeMode.js";
|
|
@@ -69,6 +67,7 @@ export * from "./Options/Classes/Particles/Move/Path/MovePath.js";
|
|
|
69
67
|
export * from "./Options/Classes/Particles/Move/Spin.js";
|
|
70
68
|
export * from "./Options/Classes/Particles/Move/MoveTrail.js";
|
|
71
69
|
export * from "./Options/Classes/Particles/Number/ParticlesNumber.js";
|
|
70
|
+
export * from "./Options/Classes/Particles/Number/ParticlesNumberLimit.js";
|
|
72
71
|
export * from "./Options/Classes/Particles/Number/ParticlesDensity.js";
|
|
73
72
|
export * from "./Options/Classes/Particles/Opacity/Opacity.js";
|
|
74
73
|
export * from "./Options/Classes/Particles/Opacity/OpacityAnimation.js";
|
package/umd/Core/Canvas.js
CHANGED
|
@@ -414,10 +414,10 @@
|
|
|
414
414
|
this.element.width = size.width = this.element.offsetWidth * pxRatio;
|
|
415
415
|
this.element.height = size.height = this.element.offsetHeight * pxRatio;
|
|
416
416
|
if (this.container.started) {
|
|
417
|
-
|
|
417
|
+
container.particles.setResizeFactor({
|
|
418
418
|
width: size.width / oldSize.width,
|
|
419
419
|
height: size.height / oldSize.height,
|
|
420
|
-
};
|
|
420
|
+
});
|
|
421
421
|
}
|
|
422
422
|
return true;
|
|
423
423
|
}
|
package/umd/Core/Container.js
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./Canvas.js", "./Utils/EventListeners.js", "../Options/Classes/Options.js", "./Particles.js", "./Retina.js", "./Utils/Constants.js", "../Utils/
|
|
7
|
+
define(["require", "exports", "../Utils/Utils.js", "./Canvas.js", "./Utils/EventListeners.js", "../Options/Classes/Options.js", "./Particles.js", "./Retina.js", "./Utils/Constants.js", "../Utils/NumberUtils.js", "../Utils/OptionsUtils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Container = void 0;
|
|
13
|
+
const Utils_js_1 = require("../Utils/Utils.js");
|
|
13
14
|
const Canvas_js_1 = require("./Canvas.js");
|
|
14
15
|
const EventListeners_js_1 = require("./Utils/EventListeners.js");
|
|
15
16
|
const Options_js_1 = require("../Options/Classes/Options.js");
|
|
16
17
|
const Particles_js_1 = require("./Particles.js");
|
|
17
18
|
const Retina_js_1 = require("./Retina.js");
|
|
18
19
|
const Constants_js_1 = require("./Utils/Constants.js");
|
|
19
|
-
const Utils_js_1 = require("../Utils/Utils.js");
|
|
20
20
|
const NumberUtils_js_1 = require("../Utils/NumberUtils.js");
|
|
21
21
|
const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
|
|
22
22
|
function guardCheck(container) {
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
}
|
|
36
36
|
class Container {
|
|
37
37
|
constructor(engine, id, sourceOptions) {
|
|
38
|
-
this.id = id;
|
|
39
38
|
this._intersectionManager = (entries) => {
|
|
40
39
|
if (!guardCheck(this) || !this.actualOptions.pauseOnOutsideViewport) {
|
|
41
40
|
return;
|
|
@@ -49,16 +48,16 @@
|
|
|
49
48
|
};
|
|
50
49
|
this._nextFrame = async (timestamp) => {
|
|
51
50
|
try {
|
|
52
|
-
if (!this.
|
|
53
|
-
this.
|
|
54
|
-
timestamp < this.
|
|
51
|
+
if (!this._smooth &&
|
|
52
|
+
this._lastFrameTime !== undefined &&
|
|
53
|
+
timestamp < this._lastFrameTime + 1000 / this.fpsLimit) {
|
|
55
54
|
this.draw(false);
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
|
-
this.
|
|
59
|
-
const delta = initDelta(timestamp - this.
|
|
57
|
+
this._lastFrameTime ??= timestamp;
|
|
58
|
+
const delta = initDelta(timestamp - this._lastFrameTime, this.fpsLimit, this._smooth);
|
|
60
59
|
this.addLifeTime(delta.value);
|
|
61
|
-
this.
|
|
60
|
+
this._lastFrameTime = timestamp;
|
|
62
61
|
if (delta.value > 1000) {
|
|
63
62
|
this.draw(false);
|
|
64
63
|
return;
|
|
@@ -77,8 +76,9 @@
|
|
|
77
76
|
}
|
|
78
77
|
};
|
|
79
78
|
this._engine = engine;
|
|
79
|
+
this.id = Symbol(id);
|
|
80
80
|
this.fpsLimit = 120;
|
|
81
|
-
this.
|
|
81
|
+
this._smooth = false;
|
|
82
82
|
this._delay = 0;
|
|
83
83
|
this._duration = 0;
|
|
84
84
|
this._lifeTime = 0;
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
this.started = false;
|
|
87
87
|
this.destroyed = false;
|
|
88
88
|
this._paused = true;
|
|
89
|
-
this.
|
|
89
|
+
this._lastFrameTime = 0;
|
|
90
90
|
this.zLayers = 100;
|
|
91
91
|
this.pageHidden = false;
|
|
92
92
|
this._sourceOptions = sourceOptions;
|
|
@@ -102,13 +102,12 @@
|
|
|
102
102
|
},
|
|
103
103
|
};
|
|
104
104
|
this.plugins = new Map();
|
|
105
|
-
this.
|
|
105
|
+
this.effectDrawers = new Map();
|
|
106
|
+
this.shapeDrawers = new Map();
|
|
106
107
|
this._options = loadContainerOptions(this._engine, this);
|
|
107
108
|
this.actualOptions = loadContainerOptions(this._engine, this);
|
|
108
109
|
this._eventListeners = new EventListeners_js_1.EventListeners(this);
|
|
109
|
-
|
|
110
|
-
this._intersectionObserver = new IntersectionObserver((entries) => this._intersectionManager(entries));
|
|
111
|
-
}
|
|
110
|
+
this._intersectionObserver = (0, Utils_js_1.safeIntersectionObserver)((entries) => this._intersectionManager(entries));
|
|
112
111
|
this._engine.dispatchEvent("containerBuilt", { container: this });
|
|
113
112
|
}
|
|
114
113
|
get options() {
|
|
@@ -214,11 +213,17 @@
|
|
|
214
213
|
this.stop();
|
|
215
214
|
this.particles.destroy();
|
|
216
215
|
this.canvas.destroy();
|
|
217
|
-
for (const [,
|
|
218
|
-
|
|
216
|
+
for (const [, effectDrawer] of this.effectDrawers) {
|
|
217
|
+
effectDrawer.destroy && effectDrawer.destroy(this);
|
|
218
|
+
}
|
|
219
|
+
for (const [, shapeDrawer] of this.shapeDrawers) {
|
|
220
|
+
shapeDrawer.destroy && shapeDrawer.destroy(this);
|
|
221
|
+
}
|
|
222
|
+
for (const key of this.effectDrawers.keys()) {
|
|
223
|
+
this.effectDrawers.delete(key);
|
|
219
224
|
}
|
|
220
|
-
for (const key of this.
|
|
221
|
-
this.
|
|
225
|
+
for (const key of this.shapeDrawers.keys()) {
|
|
226
|
+
this.shapeDrawers.delete(key);
|
|
222
227
|
}
|
|
223
228
|
this._engine.clearPlugins(this);
|
|
224
229
|
this.destroyed = true;
|
|
@@ -235,7 +240,7 @@
|
|
|
235
240
|
let refreshTime = force;
|
|
236
241
|
this._drawAnimationFrame = requestAnimationFrame(async (timestamp) => {
|
|
237
242
|
if (refreshTime) {
|
|
238
|
-
this.
|
|
243
|
+
this._lastFrameTime = undefined;
|
|
239
244
|
refreshTime = false;
|
|
240
245
|
}
|
|
241
246
|
await this._nextFrame(timestamp);
|
|
@@ -270,11 +275,18 @@
|
|
|
270
275
|
if (!guardCheck(this)) {
|
|
271
276
|
return;
|
|
272
277
|
}
|
|
278
|
+
const effects = this._engine.getSupportedEffects();
|
|
279
|
+
for (const type of effects) {
|
|
280
|
+
const drawer = this._engine.getEffectDrawer(type);
|
|
281
|
+
if (drawer) {
|
|
282
|
+
this.effectDrawers.set(type, drawer);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
273
285
|
const shapes = this._engine.getSupportedShapes();
|
|
274
286
|
for (const type of shapes) {
|
|
275
287
|
const drawer = this._engine.getShapeDrawer(type);
|
|
276
288
|
if (drawer) {
|
|
277
|
-
this.
|
|
289
|
+
this.shapeDrawers.set(type, drawer);
|
|
278
290
|
}
|
|
279
291
|
}
|
|
280
292
|
this._options = loadContainerOptions(this._engine, this, this._initialSourceOptions, this.sourceOptions);
|
|
@@ -293,8 +305,11 @@
|
|
|
293
305
|
this._delay = (0, NumberUtils_js_1.getRangeValue)(this.actualOptions.delay) * 1000;
|
|
294
306
|
this._lifeTime = 0;
|
|
295
307
|
this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
|
|
296
|
-
this.
|
|
297
|
-
for (const [, drawer] of this.
|
|
308
|
+
this._smooth = this.actualOptions.smooth;
|
|
309
|
+
for (const [, drawer] of this.effectDrawers) {
|
|
310
|
+
drawer.init && (await drawer.init(this));
|
|
311
|
+
}
|
|
312
|
+
for (const [, drawer] of this.shapeDrawers) {
|
|
298
313
|
drawer.init && (await drawer.init(this));
|
|
299
314
|
}
|
|
300
315
|
for (const [, plugin] of this.plugins) {
|
|
@@ -423,10 +438,10 @@
|
|
|
423
438
|
this.actualOptions.responsive = [];
|
|
424
439
|
const newMaxWidth = this.actualOptions.setResponsive(this.canvas.size.width, this.retina.pixelRatio, this._options);
|
|
425
440
|
this.actualOptions.setTheme(this._currentTheme);
|
|
426
|
-
if (this.
|
|
441
|
+
if (this._responsiveMaxWidth === newMaxWidth) {
|
|
427
442
|
return false;
|
|
428
443
|
}
|
|
429
|
-
this.
|
|
444
|
+
this._responsiveMaxWidth = newMaxWidth;
|
|
430
445
|
return true;
|
|
431
446
|
}
|
|
432
447
|
}
|
package/umd/Core/Engine.js
CHANGED
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
this.movers = new Map();
|
|
52
52
|
this.updaters = new Map();
|
|
53
53
|
this.presets = new Map();
|
|
54
|
-
this.
|
|
54
|
+
this.effectDrawers = new Map();
|
|
55
|
+
this.shapeDrawers = new Map();
|
|
55
56
|
this.pathGenerators = new Map();
|
|
56
57
|
}
|
|
57
58
|
get configs() {
|
|
@@ -62,18 +63,18 @@
|
|
|
62
63
|
return res;
|
|
63
64
|
}
|
|
64
65
|
get version() {
|
|
65
|
-
return "3.0.0-beta.
|
|
66
|
+
return "3.0.0-beta.4";
|
|
66
67
|
}
|
|
67
|
-
addConfig(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
addConfig(config) {
|
|
69
|
+
const name = config.name ?? "default";
|
|
70
|
+
this._configs.set(name, config);
|
|
71
|
+
this._eventDispatcher.dispatchEvent("configAdded", { data: { name, config } });
|
|
72
|
+
}
|
|
73
|
+
async addEffect(effect, drawer, refresh = true) {
|
|
74
|
+
(0, Utils_js_1.executeOnSingleOrMultiple)(effect, (type) => {
|
|
75
|
+
!this.getEffectDrawer(type) && this.effectDrawers.set(type, drawer);
|
|
76
|
+
});
|
|
77
|
+
await this.refresh(refresh);
|
|
77
78
|
}
|
|
78
79
|
addEventListener(type, listener) {
|
|
79
80
|
this._eventDispatcher.addEventListener(type, listener);
|
|
@@ -102,45 +103,11 @@
|
|
|
102
103
|
(override || !this.getPreset(preset)) && this.presets.set(preset, options);
|
|
103
104
|
await this.refresh(refresh);
|
|
104
105
|
}
|
|
105
|
-
async addShape(shape, drawer,
|
|
106
|
-
let customDrawer;
|
|
107
|
-
let realRefresh = refresh, realInit, realAfterEffect, realDestroy;
|
|
108
|
-
if ((0, Utils_js_1.isBoolean)(initOrRefresh)) {
|
|
109
|
-
realRefresh = initOrRefresh;
|
|
110
|
-
realInit = undefined;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
realInit = initOrRefresh;
|
|
114
|
-
}
|
|
115
|
-
if ((0, Utils_js_1.isBoolean)(afterEffectOrRefresh)) {
|
|
116
|
-
realRefresh = afterEffectOrRefresh;
|
|
117
|
-
realAfterEffect = undefined;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
realAfterEffect = afterEffectOrRefresh;
|
|
121
|
-
}
|
|
122
|
-
if ((0, Utils_js_1.isBoolean)(destroyOrRefresh)) {
|
|
123
|
-
realRefresh = destroyOrRefresh;
|
|
124
|
-
realDestroy = undefined;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
realDestroy = destroyOrRefresh;
|
|
128
|
-
}
|
|
129
|
-
if ((0, Utils_js_1.isFunction)(drawer)) {
|
|
130
|
-
customDrawer = {
|
|
131
|
-
afterEffect: realAfterEffect,
|
|
132
|
-
destroy: realDestroy,
|
|
133
|
-
draw: drawer,
|
|
134
|
-
init: realInit,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
customDrawer = drawer;
|
|
139
|
-
}
|
|
106
|
+
async addShape(shape, drawer, refresh = true) {
|
|
140
107
|
(0, Utils_js_1.executeOnSingleOrMultiple)(shape, (type) => {
|
|
141
|
-
!this.getShapeDrawer(type) && this.
|
|
108
|
+
!this.getShapeDrawer(type) && this.shapeDrawers.set(type, drawer);
|
|
142
109
|
});
|
|
143
|
-
await this.refresh(
|
|
110
|
+
await this.refresh(refresh);
|
|
144
111
|
}
|
|
145
112
|
clearPlugins(container) {
|
|
146
113
|
this.updaters.delete(container);
|
|
@@ -168,6 +135,9 @@
|
|
|
168
135
|
}
|
|
169
136
|
return res;
|
|
170
137
|
}
|
|
138
|
+
getEffectDrawer(type) {
|
|
139
|
+
return this.effectDrawers.get(type);
|
|
140
|
+
}
|
|
171
141
|
getInteractors(container, force = false) {
|
|
172
142
|
return getItemsFromInitializer(container, this.interactors, this._initializers.interactors, force);
|
|
173
143
|
}
|
|
@@ -184,10 +154,13 @@
|
|
|
184
154
|
return this.presets.get(preset);
|
|
185
155
|
}
|
|
186
156
|
getShapeDrawer(type) {
|
|
187
|
-
return this.
|
|
157
|
+
return this.shapeDrawers.get(type);
|
|
158
|
+
}
|
|
159
|
+
getSupportedEffects() {
|
|
160
|
+
return this.effectDrawers.keys();
|
|
188
161
|
}
|
|
189
162
|
getSupportedShapes() {
|
|
190
|
-
return this.
|
|
163
|
+
return this.shapeDrawers.keys();
|
|
191
164
|
}
|
|
192
165
|
getUpdaters(container, force = false) {
|
|
193
166
|
return getItemsFromInitializer(container, this.updaters, this._initializers.updaters, force);
|
|
@@ -206,7 +179,7 @@
|
|
|
206
179
|
domContainer.id = id;
|
|
207
180
|
document.body.append(domContainer);
|
|
208
181
|
}
|
|
209
|
-
const currentOptions = (0, Utils_js_1.itemFromSingleOrMultiple)(options, index), dom = this.dom(), oldIndex = dom.findIndex((v) => v.id === id);
|
|
182
|
+
const currentOptions = (0, Utils_js_1.itemFromSingleOrMultiple)(options, index), dom = this.dom(), oldIndex = dom.findIndex((v) => v.id.description === id);
|
|
210
183
|
if (oldIndex >= 0) {
|
|
211
184
|
const old = this.domItem(oldIndex);
|
|
212
185
|
if (old && !old.destroyed) {
|