custom-pixi-particles 4.27.1 → 4.28.0
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/README.md +49 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/effects/ShatterEffect.d.ts +43 -0
- package/dist/lib/effects/ShatterEffect.js +228 -0
- package/dist/lib/effects/ShatterEffect.js.map +1 -0
- package/dist/lib/effects/index.d.ts +1 -0
- package/dist/lib/effects/index.js +3 -0
- package/dist/lib/effects/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ If you find **CustomPIXIParticles** useful and would like to support my work, yo
|
|
|
17
17
|
- **Performance Optimized**: Handle thousands of particles with minimal performance overhead.
|
|
18
18
|
- **PIXI.js Compatibility**: Fully compatible with **PIXI.js v8**, **PIXI.js v7**, with legacy support for v5.x and v6.x.
|
|
19
19
|
- **Real-Time Customization**: Dynamically update textures, positions, configurations, and emitters on the fly.
|
|
20
|
+
- **Shatter Effect**: Create dramatic sprite shattering effects with realistic physics and automatic cleanup.
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -139,6 +140,54 @@ Clears internal object pools to free memory.
|
|
|
139
140
|
particles.clearPool()
|
|
140
141
|
```
|
|
141
142
|
|
|
143
|
+
### Shatter Effect
|
|
144
|
+
Create a dramatic shattering effect that slices a sprite into fragments with realistic physics.
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
import { ShatterEffect } from 'custom-pixi-particles'
|
|
148
|
+
import { Sprite, Texture } from 'pixi.js'
|
|
149
|
+
|
|
150
|
+
// Create a sprite to shatter
|
|
151
|
+
const sprite = new Sprite(Texture.from('my-image.png'))
|
|
152
|
+
sprite.anchor.set(0.5, 0.5)
|
|
153
|
+
sprite.x = 400
|
|
154
|
+
sprite.y = 300
|
|
155
|
+
|
|
156
|
+
// Create shatter effect with custom options
|
|
157
|
+
const shatterEffect = new ShatterEffect(sprite, {
|
|
158
|
+
gridCols: 10, // Number of horizontal grid divisions (default: 8)
|
|
159
|
+
gridRows: 10, // Number of vertical grid divisions (default: 8)
|
|
160
|
+
baseVelocity: 400, // Base velocity magnitude for fragments (default: 300)
|
|
161
|
+
velocityVariance: 0.5, // Random variance for velocity (default: 0.5)
|
|
162
|
+
rotationSpeed: 2, // Base rotation speed in radians per second (default: 2)
|
|
163
|
+
rotationVariance: 1, // Random variance for rotation speed (default: 1)
|
|
164
|
+
gravity: 600, // Gravity force applied to fragments (default: 500)
|
|
165
|
+
lifetime: 2.5, // Lifetime of fragments in seconds (default: 2)
|
|
166
|
+
fadeOutDuration: 0.3 // Fade out duration at the end of lifetime (default: 0.3)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// Add to stage
|
|
170
|
+
app.stage.addChild(shatterEffect)
|
|
171
|
+
|
|
172
|
+
// Trigger explosion with optional completion callback
|
|
173
|
+
shatterEffect.Explode(() => {
|
|
174
|
+
console.log('Shatter animation complete!')
|
|
175
|
+
shatterEffect.destroy()
|
|
176
|
+
})
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**ShatterEffect Methods:**
|
|
180
|
+
- `Explode(onComplete?)` - Triggers the shatter animation. Optionally accepts a callback when animation completes.
|
|
181
|
+
- `reset()` - Resets the effect to its initial state, allowing it to be triggered again.
|
|
182
|
+
- `destroy()` - Destroys the effect and cleans up all resources.
|
|
183
|
+
|
|
184
|
+
**Features:**
|
|
185
|
+
- Automatically slices sprites into a grid of fragments
|
|
186
|
+
- Each fragment radiates outward from the sprite's center with random variance
|
|
187
|
+
- Realistic physics with gravity and rotation
|
|
188
|
+
- Automatic cleanup and memory management using object pooling
|
|
189
|
+
- Smooth fade-out animation at the end of fragment lifetime
|
|
190
|
+
|
|
142
191
|
---
|
|
143
192
|
|
|
144
193
|
## 🖥️ Versions Compatibility
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Renderer from './lib/pixi/Renderer';
|
|
2
2
|
import { ICustomPixiParticlesSettings } from './lib/customPixiParticlesSettingsInterface';
|
|
3
3
|
import TestRenderer from './lib/pixi/TestRenderer';
|
|
4
|
+
import { ShatterEffect } from './lib/effects';
|
|
5
|
+
export type { IShatterEffectOptions, ShatterMode } from './lib/effects';
|
|
4
6
|
/**
|
|
5
7
|
* Constructs a renderer for custom pixi particles
|
|
6
8
|
* @class Renderer
|
|
@@ -12,4 +14,4 @@ declare const customPixiParticles: {
|
|
|
12
14
|
declare const _customPixiParticlesEditorOnly: {
|
|
13
15
|
create(settings: ICustomPixiParticlesSettings): TestRenderer;
|
|
14
16
|
};
|
|
15
|
-
export { Renderer, customPixiParticles, _customPixiParticlesEditorOnly, ICustomPixiParticlesSettings };
|
|
17
|
+
export { Renderer, customPixiParticles, _customPixiParticlesEditorOnly, ICustomPixiParticlesSettings, ShatterEffect };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Renderer from './lib/pixi/Renderer';
|
|
2
2
|
import TestRenderer from './lib/pixi/TestRenderer';
|
|
3
|
+
import { ShatterEffect } from './lib/effects';
|
|
3
4
|
/**
|
|
4
5
|
* Constructs a renderer for custom pixi particles
|
|
5
6
|
* @class Renderer
|
|
@@ -41,5 +42,5 @@ const _customPixiParticlesEditorOnly = {
|
|
|
41
42
|
});
|
|
42
43
|
},
|
|
43
44
|
};
|
|
44
|
-
export { Renderer, customPixiParticles, _customPixiParticlesEditorOnly };
|
|
45
|
+
export { Renderer, customPixiParticles, _customPixiParticlesEditorOnly, ShatterEffect };
|
|
45
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,Q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Q;YACR,qBAAqB;YACrB,0BAA0B;YAC1B,aAAa;YACb,iBAAiB;YACjB,MAAM;YACN,MAAM;YACN,WAAW;SACZ,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,8BAA8B,EAAgC,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Container, Sprite } from 'pixi.js-legacy';
|
|
2
|
+
export type ShatterMode = 'radial' | 'directional' | 'swirl';
|
|
3
|
+
export interface IShatterEffectOptions {
|
|
4
|
+
gridCols?: number;
|
|
5
|
+
gridRows?: number;
|
|
6
|
+
explosionPower?: number;
|
|
7
|
+
friction?: number;
|
|
8
|
+
gravity?: number;
|
|
9
|
+
turbulence?: number;
|
|
10
|
+
lifetime?: number;
|
|
11
|
+
fadeOutDuration?: number;
|
|
12
|
+
mode?: ShatterMode;
|
|
13
|
+
explosionOrigin?: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
blastDirection?: number;
|
|
18
|
+
swirlStrength?: number;
|
|
19
|
+
randomizeScale?: boolean;
|
|
20
|
+
endTint?: number;
|
|
21
|
+
}
|
|
22
|
+
export default class ShatterEffect extends Container {
|
|
23
|
+
private sourceSprite;
|
|
24
|
+
private fragments;
|
|
25
|
+
private isExploded;
|
|
26
|
+
private options;
|
|
27
|
+
private isCleanedUp;
|
|
28
|
+
private explodeResolve?;
|
|
29
|
+
constructor(sourceSprite: Sprite, options?: IShatterEffectOptions);
|
|
30
|
+
private createFragments;
|
|
31
|
+
/**
|
|
32
|
+
* Starts the explosion animation.
|
|
33
|
+
* @returns A promise that resolves when all fragments have faded out/died.
|
|
34
|
+
*/
|
|
35
|
+
Explode(): Promise<void>;
|
|
36
|
+
private update;
|
|
37
|
+
private finish;
|
|
38
|
+
private lerpColor;
|
|
39
|
+
private removeFragment;
|
|
40
|
+
private cleanup;
|
|
41
|
+
destroy(options?: any): void;
|
|
42
|
+
static shatter(sprite: Sprite, options?: IShatterEffectOptions): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Container, Sprite, Texture, Ticker, Rectangle } from 'pixi.js-legacy';
|
|
11
|
+
import ParticlePool from '../ParticlePool';
|
|
12
|
+
import Random from '../util/Random';
|
|
13
|
+
export default class ShatterEffect extends Container {
|
|
14
|
+
constructor(sourceSprite, options = {}) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
16
|
+
super();
|
|
17
|
+
this.fragments = [];
|
|
18
|
+
this.isExploded = false;
|
|
19
|
+
this.isCleanedUp = false;
|
|
20
|
+
this.sourceSprite = sourceSprite;
|
|
21
|
+
this.options = {
|
|
22
|
+
gridCols: (_a = options.gridCols) !== null && _a !== void 0 ? _a : 10,
|
|
23
|
+
gridRows: (_b = options.gridRows) !== null && _b !== void 0 ? _b : 10,
|
|
24
|
+
explosionPower: (_c = options.explosionPower) !== null && _c !== void 0 ? _c : 1000,
|
|
25
|
+
friction: (_d = options.friction) !== null && _d !== void 0 ? _d : 0.96,
|
|
26
|
+
gravity: (_e = options.gravity) !== null && _e !== void 0 ? _e : 800,
|
|
27
|
+
turbulence: (_f = options.turbulence) !== null && _f !== void 0 ? _f : 0.2,
|
|
28
|
+
lifetime: (_g = options.lifetime) !== null && _g !== void 0 ? _g : 2.0,
|
|
29
|
+
fadeOutDuration: (_h = options.fadeOutDuration) !== null && _h !== void 0 ? _h : 0.5,
|
|
30
|
+
mode: (_j = options.mode) !== null && _j !== void 0 ? _j : 'radial',
|
|
31
|
+
explosionOrigin: (_k = options.explosionOrigin) !== null && _k !== void 0 ? _k : { x: 0.5, y: 0.5 },
|
|
32
|
+
blastDirection: (_l = options.blastDirection) !== null && _l !== void 0 ? _l : 0,
|
|
33
|
+
swirlStrength: (_m = options.swirlStrength) !== null && _m !== void 0 ? _m : 0,
|
|
34
|
+
randomizeScale: (_o = options.randomizeScale) !== null && _o !== void 0 ? _o : false,
|
|
35
|
+
endTint: (_p = options.endTint) !== null && _p !== void 0 ? _p : 0xFFFFFF
|
|
36
|
+
};
|
|
37
|
+
this.x = this.sourceSprite.x;
|
|
38
|
+
this.y = this.sourceSprite.y;
|
|
39
|
+
this.rotation = this.sourceSprite.rotation;
|
|
40
|
+
this.sourceSprite.visible = false;
|
|
41
|
+
}
|
|
42
|
+
createFragments() {
|
|
43
|
+
const texture = this.sourceSprite.texture;
|
|
44
|
+
if (!texture || !texture.valid)
|
|
45
|
+
return;
|
|
46
|
+
const scale = this.sourceSprite.scale.x;
|
|
47
|
+
const texFrame = texture.frame;
|
|
48
|
+
const stepW = texFrame.width / this.options.gridCols;
|
|
49
|
+
const stepH = texFrame.height / this.options.gridRows;
|
|
50
|
+
const anchorX = this.sourceSprite.anchor.x;
|
|
51
|
+
const anchorY = this.sourceSprite.anchor.y;
|
|
52
|
+
const originX = texFrame.width * this.options.explosionOrigin.x;
|
|
53
|
+
const originY = texFrame.height * this.options.explosionOrigin.y;
|
|
54
|
+
for (let row = 0; row < this.options.gridRows; row++) {
|
|
55
|
+
for (let col = 0; col < this.options.gridCols; col++) {
|
|
56
|
+
const x1 = Math.floor(col * stepW);
|
|
57
|
+
const y1 = Math.floor(row * stepH);
|
|
58
|
+
const x2 = Math.min(Math.floor((col + 1) * stepW), texFrame.width);
|
|
59
|
+
const y2 = Math.min(Math.floor((row + 1) * stepH), texFrame.height);
|
|
60
|
+
const currentFragW = x2 - x1;
|
|
61
|
+
const currentFragH = y2 - y1;
|
|
62
|
+
if (currentFragW <= 0 || currentFragH <= 0)
|
|
63
|
+
continue;
|
|
64
|
+
const fragRect = new Rectangle(texFrame.x + x1, texFrame.y + y1, currentFragW, currentFragH);
|
|
65
|
+
const fragTex = new Texture(texture.baseTexture, fragRect);
|
|
66
|
+
const sprite = new Sprite(fragTex);
|
|
67
|
+
sprite.anchor.set(0.5);
|
|
68
|
+
const finalScale = this.options.randomizeScale ? scale * Random.uniform(0.8, 1.2) : scale;
|
|
69
|
+
sprite.scale.set(finalScale);
|
|
70
|
+
const lx = (x1 - (texFrame.width * anchorX) + currentFragW / 2) * scale;
|
|
71
|
+
const ly = (y1 - (texFrame.height * anchorY) + currentFragH / 2) * scale;
|
|
72
|
+
const dx = (x1 + currentFragW / 2) - originX;
|
|
73
|
+
const dy = (y1 + currentFragH / 2) - originY;
|
|
74
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
75
|
+
const angleToOrigin = Math.atan2(dy, dx);
|
|
76
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
|
77
|
+
let vx = 0, vy = 0;
|
|
78
|
+
if (this.options.mode === 'radial' || this.options.mode === 'swirl') {
|
|
79
|
+
const force = (1.5 - (dist / texFrame.width)) * this.options.explosionPower;
|
|
80
|
+
const angle = angleToOrigin + Random.uniform(-this.options.turbulence, this.options.turbulence);
|
|
81
|
+
vx = Math.cos(angle) * force;
|
|
82
|
+
vy = Math.sin(angle) * force;
|
|
83
|
+
if (this.options.mode === 'swirl') {
|
|
84
|
+
const swirl = this.options.swirlStrength;
|
|
85
|
+
vx += Math.cos(angle + Math.PI / 2) * (dist * swirl);
|
|
86
|
+
vy += Math.sin(angle + Math.PI / 2) * (dist * swirl);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (this.options.mode === 'directional') {
|
|
90
|
+
const force = this.options.explosionPower * Random.uniform(0.5, 1.5);
|
|
91
|
+
const angle = this.options.blastDirection + Random.uniform(-this.options.turbulence, this.options.turbulence);
|
|
92
|
+
vx = Math.cos(angle) * force;
|
|
93
|
+
vy = Math.sin(angle) * force;
|
|
94
|
+
}
|
|
95
|
+
const particle = ParticlePool.global.pop();
|
|
96
|
+
particle.reset();
|
|
97
|
+
particle.x = lx;
|
|
98
|
+
particle.y = ly;
|
|
99
|
+
particle.velocity.set(vx, vy);
|
|
100
|
+
particle.acceleration.set(0, this.options.gravity);
|
|
101
|
+
particle.maxLifeTime = this.options.lifetime * Random.uniform(0.8, 1.2);
|
|
102
|
+
particle.lifeTime = 0;
|
|
103
|
+
particle.radiansPerSecond = Random.uniform(-12, 12);
|
|
104
|
+
this.fragments.push({
|
|
105
|
+
sprite,
|
|
106
|
+
particle,
|
|
107
|
+
initialScale: finalScale,
|
|
108
|
+
vz: Random.uniform(-15, 15),
|
|
109
|
+
z: 0
|
|
110
|
+
});
|
|
111
|
+
this.addChild(sprite);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Starts the explosion animation.
|
|
117
|
+
* @returns A promise that resolves when all fragments have faded out/died.
|
|
118
|
+
*/
|
|
119
|
+
Explode() {
|
|
120
|
+
if (this.isExploded)
|
|
121
|
+
return Promise.resolve();
|
|
122
|
+
this.isExploded = true;
|
|
123
|
+
this.createFragments();
|
|
124
|
+
Ticker.shared.add(this.update, this);
|
|
125
|
+
return new Promise((resolve) => {
|
|
126
|
+
this.explodeResolve = resolve;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
update() {
|
|
130
|
+
if (!this.isExploded || this.isCleanedUp)
|
|
131
|
+
return;
|
|
132
|
+
const dt = Ticker.shared.deltaMS / 1000;
|
|
133
|
+
for (let i = this.fragments.length - 1; i >= 0; i--) {
|
|
134
|
+
const f = this.fragments[i];
|
|
135
|
+
const p = f.particle;
|
|
136
|
+
p.lifeTime += dt;
|
|
137
|
+
p.velocity.x *= this.options.friction;
|
|
138
|
+
p.velocity.y *= this.options.friction;
|
|
139
|
+
p.velocity.y += p.acceleration.y * dt;
|
|
140
|
+
p.x += p.velocity.x * dt;
|
|
141
|
+
p.y += p.velocity.y * dt;
|
|
142
|
+
p.rotation += p.radiansPerSecond * dt;
|
|
143
|
+
f.z += f.vz * dt;
|
|
144
|
+
const depthScale = Math.max(0.1, 1 + (f.z / 200));
|
|
145
|
+
f.sprite.x = p.x;
|
|
146
|
+
f.sprite.y = p.y;
|
|
147
|
+
f.sprite.rotation = p.rotation;
|
|
148
|
+
f.sprite.scale.set(f.initialScale * depthScale);
|
|
149
|
+
const progress = p.lifeTime / p.maxLifeTime;
|
|
150
|
+
if (this.options.endTint !== 0xFFFFFF) {
|
|
151
|
+
f.sprite.tint = this.lerpColor(0xFFFFFF, this.options.endTint, progress);
|
|
152
|
+
}
|
|
153
|
+
const fadeThreshold = 1 - (this.options.fadeOutDuration / p.maxLifeTime);
|
|
154
|
+
if (progress > fadeThreshold) {
|
|
155
|
+
f.sprite.alpha = Math.max(0, (1 - progress) / (1 - fadeThreshold));
|
|
156
|
+
}
|
|
157
|
+
if (p.lifeTime >= p.maxLifeTime || f.sprite.alpha <= 0) {
|
|
158
|
+
this.removeFragment(i);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (this.fragments.length === 0) {
|
|
162
|
+
this.finish();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
finish() {
|
|
166
|
+
Ticker.shared.remove(this.update, this);
|
|
167
|
+
if (this.explodeResolve) {
|
|
168
|
+
this.explodeResolve();
|
|
169
|
+
this.explodeResolve = undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
lerpColor(start, end, t) {
|
|
173
|
+
// tslint:disable-next-line:one-variable-per-declaration no-bitwise
|
|
174
|
+
const r1 = (start >> 16) & 0xff, g1 = (start >> 8) & 0xff, b1 = start & 0xff;
|
|
175
|
+
// tslint:disable-next-line:one-variable-per-declaration no-bitwise
|
|
176
|
+
const r2 = (end >> 16) & 0xff, g2 = (end >> 8) & 0xff, b2 = end & 0xff;
|
|
177
|
+
// tslint:disable-next-line:one-variable-per-declaration no-bitwise
|
|
178
|
+
const r = r1 + (r2 - r1) * t, g = g1 + (g2 - g1) * t, b = b1 + (b2 - b1) * t;
|
|
179
|
+
// tslint:disable-next-line:no-bitwise
|
|
180
|
+
return (r << 16) | (g << 8) | b;
|
|
181
|
+
}
|
|
182
|
+
removeFragment(index) {
|
|
183
|
+
const f = this.fragments[index];
|
|
184
|
+
if (f.particle)
|
|
185
|
+
ParticlePool.global.push(f.particle);
|
|
186
|
+
if (f.sprite) {
|
|
187
|
+
this.removeChild(f.sprite);
|
|
188
|
+
f.sprite.destroy();
|
|
189
|
+
}
|
|
190
|
+
this.fragments.splice(index, 1);
|
|
191
|
+
}
|
|
192
|
+
cleanup() {
|
|
193
|
+
if (this.isCleanedUp)
|
|
194
|
+
return;
|
|
195
|
+
this.isCleanedUp = true;
|
|
196
|
+
Ticker.shared.remove(this.update, this);
|
|
197
|
+
this.fragments.forEach(f => {
|
|
198
|
+
if (f.sprite) {
|
|
199
|
+
if (f.sprite.parent)
|
|
200
|
+
f.sprite.parent.removeChild(f.sprite);
|
|
201
|
+
f.sprite.destroy();
|
|
202
|
+
}
|
|
203
|
+
if (f.particle)
|
|
204
|
+
ParticlePool.global.push(f.particle);
|
|
205
|
+
});
|
|
206
|
+
this.fragments = [];
|
|
207
|
+
if (this.explodeResolve) {
|
|
208
|
+
this.explodeResolve();
|
|
209
|
+
this.explodeResolve = undefined;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
destroy(options) {
|
|
213
|
+
this.cleanup();
|
|
214
|
+
super.destroy(options);
|
|
215
|
+
}
|
|
216
|
+
static shatter(sprite_1) {
|
|
217
|
+
return __awaiter(this, arguments, void 0, function* (sprite, options = {}) {
|
|
218
|
+
if (!sprite.parent)
|
|
219
|
+
return;
|
|
220
|
+
const effect = new ShatterEffect(sprite, options);
|
|
221
|
+
const index = sprite.parent.getChildIndex(sprite);
|
|
222
|
+
sprite.parent.addChildAt(effect, index);
|
|
223
|
+
yield effect.Explode();
|
|
224
|
+
effect.destroy();
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=ShatterEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShatterEffect.js","sourceRoot":"","sources":["../../../src/lib/effects/ShatterEffect.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAE1C,OAAO,MAAM,MAAM,gBAAgB,CAAA;AA8BnC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IASlD,YAAY,YAAoB,EAAE,UAAiC,EAAE;;QACnE,KAAK,EAAE,CAAA;QARD,cAAS,GAAe,EAAE,CAAA;QAC1B,eAAU,GAAY,KAAK,CAAA;QAE3B,gBAAW,GAAY,KAAK,CAAA;QAOlC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG;YACb,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE;YAChC,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE;YAChC,cAAc,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAI;YAC9C,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,IAAI;YAClC,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG;YAC/B,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,GAAG;YACrC,QAAQ,EAAE,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G,SAAS,CAAA;QACjC,CAAC;IACH,CAAC;IAEM,OAAO,CAAC,OAAa;QAC1B,IAAI,CAAC,OAAO,EAAE,CAAA;QACd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IAEM,MAAM,CAAO,OAAO;6DAAC,MAAc,EAAE,UAAiC,EAAE;YAC7E,IAAI,CAAC,MAAM,CAAC,MAAM;gBAAE,OAAO;YAC3B,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAExC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ShatterEffect, IShatterEffectOptions, ShatterMode } from './ShatterEffect';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/effects/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAsC,MAAM,iBAAiB,CAAA"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as controller from './emission';
|
|
2
2
|
import * as behaviour from './behaviour';
|
|
3
3
|
import * as parser from './parser';
|
|
4
|
+
import * as effects from './effects';
|
|
4
5
|
import Particle from './Particle';
|
|
5
6
|
import ParticlePool from './ParticlePool';
|
|
6
7
|
import { Duration, Emitter } from './emitter';
|
|
@@ -11,6 +12,7 @@ declare const cpp: {
|
|
|
11
12
|
parser: typeof parser;
|
|
12
13
|
controller: typeof controller;
|
|
13
14
|
behaviour: typeof behaviour;
|
|
15
|
+
effects: typeof effects;
|
|
14
16
|
Color: typeof Color;
|
|
15
17
|
Point: typeof Point;
|
|
16
18
|
Random: typeof Random;
|
package/dist/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as controller from './emission';
|
|
2
2
|
import * as behaviour from './behaviour';
|
|
3
3
|
import * as parser from './parser';
|
|
4
|
+
import * as effects from './effects';
|
|
4
5
|
import Particle from './Particle';
|
|
5
6
|
import ParticlePool from './ParticlePool';
|
|
6
7
|
import { Duration, Emitter } from './emitter';
|
|
@@ -11,6 +12,7 @@ const cpp = {
|
|
|
11
12
|
parser,
|
|
12
13
|
controller,
|
|
13
14
|
behaviour,
|
|
15
|
+
effects,
|
|
14
16
|
Color,
|
|
15
17
|
Point,
|
|
16
18
|
Random,
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,MAAM,GAAG,GAAG;IACV,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,KAAK;IACL,KAAK;IACL,MAAM;IACN,QAAQ;IACR,OAAO;CACR,CAAA;AAED,eAAe,GAAG,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,MAAM,GAAG,GAAG;IACV,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,KAAK;IACL,KAAK;IACL,MAAM;IACN,QAAQ;IACR,OAAO;CACR,CAAA;AAED,eAAe,GAAG,CAAA"}
|
package/package.json
CHANGED