@meijie/vue-fireworks 0.1.1 → 0.2.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 +112 -27
- package/dist/engine.cjs +1 -0
- package/dist/engine.d.ts +20 -0
- package/dist/engine.js +187 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +95 -0
- package/dist/shared-shared-cjs.cjs +1 -0
- package/dist/shared-shared-es.js +6 -0
- package/dist/vue3.cjs +1 -0
- package/dist/vue3.d.ts +50 -0
- package/dist/vue3.js +96 -0
- package/package.json +46 -34
- package/dist/demo.html +0 -19
- package/dist/vueFireworks.common.js +0 -1798
- package/dist/vueFireworks.common.js.map +0 -1
- package/dist/vueFireworks.css +0 -1
- package/dist/vueFireworks.umd.js +0 -1808
- package/dist/vueFireworks.umd.js.map +0 -1
- package/dist/vueFireworks.umd.min.js +0 -2
- package/dist/vueFireworks.umd.min.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,35 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @LastEditors: meijie
|
|
6
|
-
* @LastEditTime: 2020-10-12 14:00:24
|
|
7
|
-
-->
|
|
8
|
-
# vue-fireworks
|
|
9
|
-
>模拟礼花迸发效果,canvas实现
|
|
1
|
+
# @meijie/vue-fireworks
|
|
2
|
+
|
|
3
|
+
基于 Canvas 的烟花/礼花特效组件。支持 **Vue 2.6+** 与 **Vue 3**,粒子数量、颜色、形状、绽放位置、拖尾、发光全部可配置,支持**固定位置绽放**与**跟随鼠标**。
|
|
4
|
+
|
|
10
5
|
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @meijie/vue-fireworks
|
|
11
9
|
```
|
|
12
|
-
npm i @meijie/vue-fireworks
|
|
13
|
-
```
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
`vue` 为 peerDependency,需项目中已安装 Vue 2.6+ 或 Vue 3。
|
|
12
|
+
|
|
13
|
+
## 快速开始
|
|
14
|
+
|
|
15
|
+
### Vue 3(`v-model:show`)
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<VueFireworks v-model:show="show" :glow="true" :trail="true" shape="star" />
|
|
20
|
+
<button @click="show = true">放烟花</button>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
import VueFireworks from '@meijie/vue-fireworks/vue3'
|
|
26
|
+
const show = ref(false)
|
|
27
|
+
</script>
|
|
16
28
|
```
|
|
29
|
+
|
|
30
|
+
### Vue 2(`.sync`)
|
|
31
|
+
|
|
32
|
+
```vue
|
|
17
33
|
<template>
|
|
18
|
-
<VueFireworks :show.sync="
|
|
34
|
+
<VueFireworks :show.sync="show" :glow="true" />
|
|
35
|
+
<button @click="show = true">放烟花</button>
|
|
19
36
|
</template>
|
|
37
|
+
|
|
20
38
|
<script>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
VueFireworks
|
|
27
|
-
},
|
|
28
|
-
data () {
|
|
29
|
-
return {
|
|
30
|
-
isShowFireworks: false
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
39
|
+
import VueFireworks from '@meijie/vue-fireworks' // 或 '/vue2'
|
|
40
|
+
export default {
|
|
41
|
+
components: { VueFireworks },
|
|
42
|
+
data: () => ({ show: false })
|
|
43
|
+
}
|
|
34
44
|
</script>
|
|
35
|
-
```
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
播放完毕组件会自动把 `show` 置回 `false`,可连续触发。
|
|
48
|
+
|
|
49
|
+
## 导入路径
|
|
50
|
+
|
|
51
|
+
| 路径 | 用途 |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `@meijie/vue-fireworks` | 默认 = Vue 2 版本(兼容老用户) |
|
|
54
|
+
| `@meijie/vue-fireworks/vue2` | Vue 2 显式入口 |
|
|
55
|
+
| `@meijie/vue-fireworks/vue3` | Vue 3 入口 |
|
|
56
|
+
| `@meijie/vue-fireworks/engine` | 纯 JS 引擎,脱离 Vue 直接用 |
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `show` | Boolean | `false` | 显示/触发,配合 `.sync`(Vue2)或 `v-model:show`(Vue3) |
|
|
63
|
+
| `count` | Number | `60` | 每轮粒子数量 |
|
|
64
|
+
| `colors` | String[] | `['#FF8201','#2DA6E0','#FF262B']` | 粒子颜色池 |
|
|
65
|
+
| `shape` | String | `'rect'` | 粒子形状:`rect` / `circle` / `star` |
|
|
66
|
+
| `origin` | String \| Object | `'center'` | 绽放原点,`'center'` 或 `{ x, y }`(canvas 内 CSS 像素) |
|
|
67
|
+
| `followMouse` | Boolean | `false` | 跟随鼠标绽放,优先级高于 `origin` |
|
|
68
|
+
| `gravity` | Number | `0.12` | 重力加速度 |
|
|
69
|
+
| `friction` | Number | `0.985` | 空气阻力(速度衰减) |
|
|
70
|
+
| `spread` | Number | `5` | 爆炸初速度上限 |
|
|
71
|
+
| `size` | Number | `4` | 粒子尺寸(px) |
|
|
72
|
+
| `duration` | Number | `90` | 粒子最大寿命(帧) |
|
|
73
|
+
| `trail` | Boolean | `false` | 拖尾残影 |
|
|
74
|
+
| `glow` | Boolean | `false` | 发光效果 |
|
|
75
|
+
| `fps` | Number | `60` | 渲染帧率 |
|
|
76
|
+
|
|
77
|
+
### 固定位置绽放
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<VueFireworks v-model:show="show" :origin="{ x: 300, y: 200 }" />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 跟随鼠标
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<VueFireworks v-model:show="show" :followMouse="true" />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 事件
|
|
90
|
+
|
|
91
|
+
| 事件 | 说明 |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `update:show` | 播放结束时触发,用于同步 `show` 为 `false` |
|
|
94
|
+
| `start` | 开始播放时触发 |
|
|
95
|
+
| `end` | 播放结束时触发 |
|
|
96
|
+
|
|
97
|
+
## 命令式方法(ref)
|
|
98
|
+
|
|
99
|
+
```vue
|
|
100
|
+
<VueFireworks ref="fw" />
|
|
101
|
+
<script setup>
|
|
102
|
+
const fw = ref()
|
|
103
|
+
fw.value.fire({ origin: { x: 100, y: 100 }, count: 100 }) // 带临时配置触发
|
|
104
|
+
fw.value.stop() // 立即停止
|
|
105
|
+
</script>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 脱离 Vue 使用引擎
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
import { FireworksEngine } from '@meijie/vue-fireworks/engine'
|
|
112
|
+
const engine = new FireworksEngine(canvasEl, { count: 80, glow: true })
|
|
113
|
+
engine.onEnd = () => console.log('done')
|
|
114
|
+
engine.fire()
|
|
115
|
+
// engine.setOptions({ shape: 'star' }); engine.stop(); engine.destroy()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/dist/engine.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f={count:60,colors:["#FF8201","#2DA6E0","#FF262B"],shape:"rect",gravity:.12,friction:.985,spread:5,size:4,trail:!1,glow:!1,duration:90,origin:"center",followMouse:!1,fps:60};class d{constructor(t,i={}){if(!t)throw new Error("[vue-fireworks] canvas element is required");if(this.canvas=t,this.ctx=t.getContext("2d"),!this.ctx)throw new Error("[vue-fireworks] 2d context not available");this.options={...f,...i},this.particles=[],this.rafId=null,this.running=!1,this.finished=!1,this.frame=0,this.lastTime=0,this.accumulator=0,this.mousePoint=null,this.onEnd=null,this._onMouseMove=this._onMouseMove.bind(this),this._loop=this._loop.bind(this),this._resize=this._resize.bind(this),this._bindMouse(),this._resize(),window.addEventListener("resize",this._resize)}setOptions(t={}){const i=this.options.followMouse;this.options={...this.options,...t},i!==this.options.followMouse&&(this._unbindMouse(),this._bindMouse())}fire(t={}){const i={...this.options,...t},e=this._resolveOrigin(i);this.particles=[],this.finished=!1,this.frame=0,this.lastTime=0,this.accumulator=0;for(let s=0;s<i.count;s++){const o=Math.random()*Math.PI*2,n=i.spread*(.35+Math.random()*.65);this.particles.push({x:e.x,y:e.y,vx:Math.cos(o)*n,vy:Math.sin(o)*n-1.5,color:i.colors[Math.floor(Math.random()*i.colors.length)],size:i.size*(.6+Math.random()*.8),life:0,maxLife:i.duration*(.75+Math.random()*.5),rotation:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.2})}this.running||(this.running=!0,this.rafId=requestAnimationFrame(this._loop))}stop(){this._teardown(),this._clear()}destroy(){this.stop(),window.removeEventListener("resize",this._resize),this._unbindMouse(),this.onEnd=null}_resolveOrigin(t){return t.followMouse&&this.mousePoint?{...this.mousePoint}:t.origin==="center"?{x:this.cssWidth/2,y:this.cssHeight/2}:t.origin&&typeof t.origin=="object"?{x:t.origin.x,y:t.origin.y}:{x:this.cssWidth/2,y:this.cssHeight/2}}_onMouseMove(t){const i=this.canvas.getBoundingClientRect();this.mousePoint={x:t.clientX-i.left,y:t.clientY-i.top}}_bindMouse(){this.options.followMouse&&window.addEventListener("mousemove",this._onMouseMove)}_unbindMouse(){window.removeEventListener("mousemove",this._onMouseMove),this.mousePoint=null}_resize(){const t=Math.min(window.devicePixelRatio||1,2),i=this.canvas.getBoundingClientRect();this.cssWidth=i.width||this.canvas.clientWidth||window.innerWidth,this.cssHeight=i.height||this.canvas.clientHeight||window.innerHeight*.6,this.canvas.width=Math.round(this.cssWidth*t),this.canvas.height=Math.round(this.cssHeight*t),this.ctx.setTransform(t,0,0,t,0,0)}_clear(){this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.restore()}_loop(t){if(!this.running)return;this.lastTime||(this.lastTime=t);const i=t-this.lastTime;this.lastTime=t;const e=1e3/this.options.fps;this.accumulator+=Math.min(i,e*3);let s=0;for(;this.accumulator>=e&&s<3;)this._update(),this.accumulator-=e,s++;if(this._render(),this.frame++,this.particles.length===0){this._teardown(),this._clear(),typeof this.onEnd=="function"&&this.onEnd();return}this.rafId=requestAnimationFrame(this._loop)}_update(){const{gravity:t,friction:i}=this.options;for(let e=this.particles.length-1;e>=0;e--){const s=this.particles[e];s.vx*=i,s.vy=s.vy*i+t,s.x+=s.vx,s.y+=s.vy,s.rotation+=s.spin,s.life++,(s.life>=s.maxLife||s.y-s.size>this.cssHeight)&&this.particles.splice(e,1)}}_render(){const t=this.ctx,i=this.options;if(i.trail?(t.globalCompositeOperation="destination-out",t.fillStyle="rgba(0,0,0,0.22)",t.fillRect(0,0,this.cssWidth,this.cssHeight)):t.clearRect(0,0,this.cssWidth,this.cssHeight),i.glow){t.globalCompositeOperation="lighter";for(const e of this.particles){const s=Math.max(0,1-e.life/e.maxLife);t.globalAlpha=s*.9;const o=this._getGlowSprite(e.color),n=e.size*2.4;t.drawImage(o,e.x-n,e.y-n,n*2,n*2)}}t.globalCompositeOperation=i.glow?"lighter":"source-over";for(const e of this.particles){const s=Math.max(0,1-e.life/e.maxLife);t.globalAlpha=s,t.fillStyle=e.color,this._drawShape(t,e,i.shape)}t.globalAlpha=1,t.globalCompositeOperation="source-over"}_getGlowSprite(t){this._glowCache||(this._glowCache=new Map);let i=this._glowCache.get(t);if(i)return i;const e=64;i=document.createElement("canvas"),i.width=i.height=e;const s=i.getContext("2d"),o=s.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);return o.addColorStop(0,t),o.addColorStop(.35,this._withAlpha(t,.5)),o.addColorStop(1,this._withAlpha(t,0)),s.fillStyle=o,s.fillRect(0,0,e,e),this._glowCache.set(t,i),i}_withAlpha(t,i){if(t[0]==="#"){let s=t.slice(1);s.length===3&&(s=s.split("").map(n=>n+n).join(""));const o=parseInt(s,16);return`rgba(${o>>16&255},${o>>8&255},${o&255},${i})`}const e=t.match(/rgba?\(([^)]+)\)/);if(e){const s=e[1].split(",").map(o=>parseFloat(o));return`rgba(${s[0]},${s[1]},${s[2]},${i})`}return t}_drawShape(t,i,e){const s=i.size;if(e==="circle"){t.beginPath(),t.arc(i.x,i.y,s/2,0,Math.PI*2),t.fill();return}if(e==="star"){this._starPath(t,i.x,i.y,5,s/2,s/4,i.rotation),t.fill();return}t.save(),t.translate(i.x,i.y),t.rotate(i.rotation),t.fillRect(-s/2,-s/2,s,s*1.6),t.restore()}_starPath(t,i,e,s,o,n,u){t.save(),t.translate(i,e),t.rotate(u),t.beginPath();for(let r=0;r<s*2;r++){const h=r%2===0?o:n,a=r*Math.PI/s-Math.PI/2,l=Math.cos(a)*h,c=Math.sin(a)*h;r===0?t.moveTo(l,c):t.lineTo(l,c)}t.closePath(),t.restore()}_teardown(){this.running=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.particles=[],this.finished=!0}}exports.FireworksEngine=d;exports.default=d;
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FireworksOptions } from './index'
|
|
2
|
+
|
|
3
|
+
export * from './index'
|
|
4
|
+
|
|
5
|
+
export declare class FireworksEngine {
|
|
6
|
+
constructor(canvas: HTMLCanvasElement, options?: FireworksOptions)
|
|
7
|
+
options: FireworksOptions
|
|
8
|
+
/** 运行时更新配置 */
|
|
9
|
+
setOptions(options?: FireworksOptions): void
|
|
10
|
+
/** 触发一轮,overrides 临时覆盖配置 */
|
|
11
|
+
fire(overrides?: FireworksOptions): void
|
|
12
|
+
/** 立即停止并清空 */
|
|
13
|
+
stop(): void
|
|
14
|
+
/** 彻底销毁并解绑事件 */
|
|
15
|
+
destroy(): void
|
|
16
|
+
/** 播放结束回调 */
|
|
17
|
+
onEnd: (() => void) | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default FireworksEngine
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
const f = {
|
|
2
|
+
count: 60,
|
|
3
|
+
// 每轮粒子数
|
|
4
|
+
colors: ["#FF8201", "#2DA6E0", "#FF262B"],
|
|
5
|
+
// 颜色池
|
|
6
|
+
shape: "rect",
|
|
7
|
+
// 'rect' | 'circle' | 'star'
|
|
8
|
+
gravity: 0.12,
|
|
9
|
+
// 重力加速度(px/frame^2)
|
|
10
|
+
friction: 0.985,
|
|
11
|
+
// 空气阻力(速度衰减系数)
|
|
12
|
+
spread: 5,
|
|
13
|
+
// 爆炸初速度上限
|
|
14
|
+
size: 4,
|
|
15
|
+
// 粒子尺寸(px)
|
|
16
|
+
trail: !1,
|
|
17
|
+
// 拖尾残影
|
|
18
|
+
glow: !1,
|
|
19
|
+
// 发光
|
|
20
|
+
duration: 90,
|
|
21
|
+
// 粒子最大寿命(帧)
|
|
22
|
+
origin: "center",
|
|
23
|
+
// 'center' | { x, y },(x,y) 为 CSS 像素坐标
|
|
24
|
+
followMouse: !1,
|
|
25
|
+
// 跟随鼠标
|
|
26
|
+
fps: 60
|
|
27
|
+
};
|
|
28
|
+
class p {
|
|
29
|
+
constructor(t, i = {}) {
|
|
30
|
+
if (!t)
|
|
31
|
+
throw new Error("[vue-fireworks] canvas element is required");
|
|
32
|
+
if (this.canvas = t, this.ctx = t.getContext("2d"), !this.ctx)
|
|
33
|
+
throw new Error("[vue-fireworks] 2d context not available");
|
|
34
|
+
this.options = { ...f, ...i }, this.particles = [], this.rafId = null, this.running = !1, this.finished = !1, this.frame = 0, this.lastTime = 0, this.accumulator = 0, this.mousePoint = null, this.onEnd = null, this._onMouseMove = this._onMouseMove.bind(this), this._loop = this._loop.bind(this), this._resize = this._resize.bind(this), this._bindMouse(), this._resize(), window.addEventListener("resize", this._resize);
|
|
35
|
+
}
|
|
36
|
+
/** 运行时更新配置 */
|
|
37
|
+
setOptions(t = {}) {
|
|
38
|
+
const i = this.options.followMouse;
|
|
39
|
+
this.options = { ...this.options, ...t }, i !== this.options.followMouse && (this._unbindMouse(), this._bindMouse());
|
|
40
|
+
}
|
|
41
|
+
/** 触发一轮烟花。overrides 可临时覆盖配置。 */
|
|
42
|
+
fire(t = {}) {
|
|
43
|
+
const i = { ...this.options, ...t }, e = this._resolveOrigin(i);
|
|
44
|
+
this.particles = [], this.finished = !1, this.frame = 0, this.lastTime = 0, this.accumulator = 0;
|
|
45
|
+
for (let s = 0; s < i.count; s++) {
|
|
46
|
+
const o = Math.random() * Math.PI * 2, n = i.spread * (0.35 + Math.random() * 0.65);
|
|
47
|
+
this.particles.push({
|
|
48
|
+
x: e.x,
|
|
49
|
+
y: e.y,
|
|
50
|
+
vx: Math.cos(o) * n,
|
|
51
|
+
vy: Math.sin(o) * n - 1.5,
|
|
52
|
+
// 略微上抛
|
|
53
|
+
color: i.colors[Math.floor(Math.random() * i.colors.length)],
|
|
54
|
+
size: i.size * (0.6 + Math.random() * 0.8),
|
|
55
|
+
life: 0,
|
|
56
|
+
maxLife: i.duration * (0.75 + Math.random() * 0.5),
|
|
57
|
+
rotation: Math.random() * Math.PI * 2,
|
|
58
|
+
spin: (Math.random() - 0.5) * 0.2
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
this.running || (this.running = !0, this.rafId = requestAnimationFrame(this._loop));
|
|
62
|
+
}
|
|
63
|
+
/** 立即停止并清空 */
|
|
64
|
+
stop() {
|
|
65
|
+
this._teardown(), this._clear();
|
|
66
|
+
}
|
|
67
|
+
/** 彻底销毁,解绑所有事件 */
|
|
68
|
+
destroy() {
|
|
69
|
+
this.stop(), window.removeEventListener("resize", this._resize), this._unbindMouse(), this.onEnd = null;
|
|
70
|
+
}
|
|
71
|
+
// ---------- private ----------
|
|
72
|
+
_resolveOrigin(t) {
|
|
73
|
+
return t.followMouse && this.mousePoint ? { ...this.mousePoint } : t.origin === "center" ? { x: this.cssWidth / 2, y: this.cssHeight / 2 } : t.origin && typeof t.origin == "object" ? { x: t.origin.x, y: t.origin.y } : { x: this.cssWidth / 2, y: this.cssHeight / 2 };
|
|
74
|
+
}
|
|
75
|
+
_onMouseMove(t) {
|
|
76
|
+
const i = this.canvas.getBoundingClientRect();
|
|
77
|
+
this.mousePoint = { x: t.clientX - i.left, y: t.clientY - i.top };
|
|
78
|
+
}
|
|
79
|
+
_bindMouse() {
|
|
80
|
+
this.options.followMouse && window.addEventListener("mousemove", this._onMouseMove);
|
|
81
|
+
}
|
|
82
|
+
_unbindMouse() {
|
|
83
|
+
window.removeEventListener("mousemove", this._onMouseMove), this.mousePoint = null;
|
|
84
|
+
}
|
|
85
|
+
_resize() {
|
|
86
|
+
const t = Math.min(window.devicePixelRatio || 1, 2), i = this.canvas.getBoundingClientRect();
|
|
87
|
+
this.cssWidth = i.width || this.canvas.clientWidth || window.innerWidth, this.cssHeight = i.height || this.canvas.clientHeight || window.innerHeight * 0.6, this.canvas.width = Math.round(this.cssWidth * t), this.canvas.height = Math.round(this.cssHeight * t), this.ctx.setTransform(t, 0, 0, t, 0, 0);
|
|
88
|
+
}
|
|
89
|
+
_clear() {
|
|
90
|
+
this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.restore();
|
|
91
|
+
}
|
|
92
|
+
_loop(t) {
|
|
93
|
+
if (!this.running)
|
|
94
|
+
return;
|
|
95
|
+
this.lastTime || (this.lastTime = t);
|
|
96
|
+
const i = t - this.lastTime;
|
|
97
|
+
this.lastTime = t;
|
|
98
|
+
const e = 1e3 / this.options.fps;
|
|
99
|
+
this.accumulator += Math.min(i, e * 3);
|
|
100
|
+
let s = 0;
|
|
101
|
+
for (; this.accumulator >= e && s < 3; )
|
|
102
|
+
this._update(), this.accumulator -= e, s++;
|
|
103
|
+
if (this._render(), this.frame++, this.particles.length === 0) {
|
|
104
|
+
this._teardown(), this._clear(), typeof this.onEnd == "function" && this.onEnd();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.rafId = requestAnimationFrame(this._loop);
|
|
108
|
+
}
|
|
109
|
+
_update() {
|
|
110
|
+
const { gravity: t, friction: i } = this.options;
|
|
111
|
+
for (let e = this.particles.length - 1; e >= 0; e--) {
|
|
112
|
+
const s = this.particles[e];
|
|
113
|
+
s.vx *= i, s.vy = s.vy * i + t, s.x += s.vx, s.y += s.vy, s.rotation += s.spin, s.life++, (s.life >= s.maxLife || s.y - s.size > this.cssHeight) && this.particles.splice(e, 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
_render() {
|
|
117
|
+
const t = this.ctx, i = this.options;
|
|
118
|
+
if (i.trail ? (t.globalCompositeOperation = "destination-out", t.fillStyle = "rgba(0,0,0,0.22)", t.fillRect(0, 0, this.cssWidth, this.cssHeight)) : t.clearRect(0, 0, this.cssWidth, this.cssHeight), i.glow) {
|
|
119
|
+
t.globalCompositeOperation = "lighter";
|
|
120
|
+
for (const e of this.particles) {
|
|
121
|
+
const s = Math.max(0, 1 - e.life / e.maxLife);
|
|
122
|
+
t.globalAlpha = s * 0.9;
|
|
123
|
+
const o = this._getGlowSprite(e.color), n = e.size * 2.4;
|
|
124
|
+
t.drawImage(o, e.x - n, e.y - n, n * 2, n * 2);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
t.globalCompositeOperation = i.glow ? "lighter" : "source-over";
|
|
128
|
+
for (const e of this.particles) {
|
|
129
|
+
const s = Math.max(0, 1 - e.life / e.maxLife);
|
|
130
|
+
t.globalAlpha = s, t.fillStyle = e.color, this._drawShape(t, e, i.shape);
|
|
131
|
+
}
|
|
132
|
+
t.globalAlpha = 1, t.globalCompositeOperation = "source-over";
|
|
133
|
+
}
|
|
134
|
+
/** 按颜色缓存发光贴图(离屏 canvas),一次生成、多帧复用 */
|
|
135
|
+
_getGlowSprite(t) {
|
|
136
|
+
this._glowCache || (this._glowCache = /* @__PURE__ */ new Map());
|
|
137
|
+
let i = this._glowCache.get(t);
|
|
138
|
+
if (i)
|
|
139
|
+
return i;
|
|
140
|
+
const e = 64;
|
|
141
|
+
i = document.createElement("canvas"), i.width = i.height = e;
|
|
142
|
+
const s = i.getContext("2d"), o = s.createRadialGradient(e / 2, e / 2, 0, e / 2, e / 2, e / 2);
|
|
143
|
+
return o.addColorStop(0, t), o.addColorStop(0.35, this._withAlpha(t, 0.5)), o.addColorStop(1, this._withAlpha(t, 0)), s.fillStyle = o, s.fillRect(0, 0, e, e), this._glowCache.set(t, i), i;
|
|
144
|
+
}
|
|
145
|
+
/** 给 hex / rgb 颜色附加 alpha,供渐变使用 */
|
|
146
|
+
_withAlpha(t, i) {
|
|
147
|
+
if (t[0] === "#") {
|
|
148
|
+
let s = t.slice(1);
|
|
149
|
+
s.length === 3 && (s = s.split("").map((n) => n + n).join(""));
|
|
150
|
+
const o = parseInt(s, 16);
|
|
151
|
+
return `rgba(${o >> 16 & 255},${o >> 8 & 255},${o & 255},${i})`;
|
|
152
|
+
}
|
|
153
|
+
const e = t.match(/rgba?\(([^)]+)\)/);
|
|
154
|
+
if (e) {
|
|
155
|
+
const s = e[1].split(",").map((o) => parseFloat(o));
|
|
156
|
+
return `rgba(${s[0]},${s[1]},${s[2]},${i})`;
|
|
157
|
+
}
|
|
158
|
+
return t;
|
|
159
|
+
}
|
|
160
|
+
_drawShape(t, i, e) {
|
|
161
|
+
const s = i.size;
|
|
162
|
+
if (e === "circle") {
|
|
163
|
+
t.beginPath(), t.arc(i.x, i.y, s / 2, 0, Math.PI * 2), t.fill();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (e === "star") {
|
|
167
|
+
this._starPath(t, i.x, i.y, 5, s / 2, s / 4, i.rotation), t.fill();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
t.save(), t.translate(i.x, i.y), t.rotate(i.rotation), t.fillRect(-s / 2, -s / 2, s, s * 1.6), t.restore();
|
|
171
|
+
}
|
|
172
|
+
_starPath(t, i, e, s, o, n, d) {
|
|
173
|
+
t.save(), t.translate(i, e), t.rotate(d), t.beginPath();
|
|
174
|
+
for (let h = 0; h < s * 2; h++) {
|
|
175
|
+
const r = h % 2 === 0 ? o : n, a = h * Math.PI / s - Math.PI / 2, l = Math.cos(a) * r, c = Math.sin(a) * r;
|
|
176
|
+
h === 0 ? t.moveTo(l, c) : t.lineTo(l, c);
|
|
177
|
+
}
|
|
178
|
+
t.closePath(), t.restore();
|
|
179
|
+
}
|
|
180
|
+
_teardown() {
|
|
181
|
+
this.running = !1, this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.particles = [], this.finished = !0;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export {
|
|
185
|
+
p as FireworksEngine,
|
|
186
|
+
p as default
|
|
187
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./engine.cjs"),r=require("./shared-shared-cjs.cjs"),s=["count","colors","shape","gravity","friction","spread","size","trail","glow","duration","origin","followMouse","fps"],n={name:"VueFireworks",props:{show:{type:Boolean,default:!1},count:{type:Number},colors:{type:Array},shape:{type:String,validator:e=>["rect","circle","star"].includes(e)},gravity:{type:Number},friction:{type:Number},spread:{type:Number},size:{type:Number},trail:{type:Boolean},glow:{type:Boolean},duration:{type:Number},origin:{type:[String,Object]},followMouse:{type:Boolean},fps:{type:Number}},data(){return{engine:null}},watch:{show(e){e?this.fire():this.engine&&this.engine.stop()},...s.reduce((e,t)=>(e[t]={handler(i){this.engine&&this.engine.setOptions({[t]:i})}},e),{})},mounted(){this.engine=new o.FireworksEngine(this.$refs.canvas,this._engineOptions()),this.engine.onEnd=()=>{r.emitUpdate(this,!1),this.$emit("end")},this.show&&this.fire()},beforeDestroy(){this.engine&&this.engine.destroy(),this.engine=null},methods:{_engineOptions(){const e={};for(const t of s){const i=this[t];i!==void 0&&(e[t]=i)}return e},fire(e){this.engine&&(this.$emit("start"),this.engine.fire(e))},stop(){this.engine&&this.engine.stop()}},render(e){return e("div",{class:"fireworks-container",style:{position:"fixed",inset:"0",zIndex:"11",pointerEvents:this.followMouse?"none":"auto"}},[e("canvas",{ref:"canvas",style:{width:"100%",height:"100%",display:"block"}})])}};n.install=function(e){e.component(n.name,n)};exports.default=n;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** 粒子形状 */
|
|
2
|
+
export type FireworksShape = 'rect' | 'circle' | 'star'
|
|
3
|
+
|
|
4
|
+
/** 绽放原点:'center' 或 canvas 内的 CSS 像素坐标 */
|
|
5
|
+
export type FireworksOrigin = 'center' | { x: number; y: number }
|
|
6
|
+
|
|
7
|
+
/** 所有可配置项(props 与 engine options 共用) */
|
|
8
|
+
export interface FireworksOptions {
|
|
9
|
+
/** 每轮粒子数,默认 60 */
|
|
10
|
+
count?: number
|
|
11
|
+
/** 颜色池,默认 ['#FF8201','#2DA6E0','#FF262B'] */
|
|
12
|
+
colors?: string[]
|
|
13
|
+
/** 粒子形状,默认 'rect' */
|
|
14
|
+
shape?: FireworksShape
|
|
15
|
+
/** 重力加速度(px/frame²),默认 0.12 */
|
|
16
|
+
gravity?: number
|
|
17
|
+
/** 空气阻力(速度衰减系数),默认 0.985 */
|
|
18
|
+
friction?: number
|
|
19
|
+
/** 爆炸初速度上限,默认 5 */
|
|
20
|
+
spread?: number
|
|
21
|
+
/** 粒子尺寸(px),默认 4 */
|
|
22
|
+
size?: number
|
|
23
|
+
/** 拖尾残影,默认 false */
|
|
24
|
+
trail?: boolean
|
|
25
|
+
/** 发光,默认 false */
|
|
26
|
+
glow?: boolean
|
|
27
|
+
/** 粒子最大寿命(帧),默认 90 */
|
|
28
|
+
duration?: number
|
|
29
|
+
/** 绽放原点,默认 'center' */
|
|
30
|
+
origin?: FireworksOrigin
|
|
31
|
+
/** 跟随鼠标(优先级高于 origin),默认 false */
|
|
32
|
+
followMouse?: boolean
|
|
33
|
+
/** 帧率,默认 60 */
|
|
34
|
+
fps?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Vue 组件实例上暴露的命令式方法 */
|
|
38
|
+
export interface VueFireworksInstance {
|
|
39
|
+
/** 手动触发一轮,可临时覆盖配置 */
|
|
40
|
+
fire(overrides?: FireworksOptions): void
|
|
41
|
+
/** 立即停止并清空 */
|
|
42
|
+
stop(): void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const VueFireworks: {
|
|
46
|
+
name: string
|
|
47
|
+
install(app: any): void
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default VueFireworks
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { FireworksEngine as o } from "./engine.js";
|
|
2
|
+
import { e as r } from "./shared-shared-es.js";
|
|
3
|
+
const s = [
|
|
4
|
+
"count",
|
|
5
|
+
"colors",
|
|
6
|
+
"shape",
|
|
7
|
+
"gravity",
|
|
8
|
+
"friction",
|
|
9
|
+
"spread",
|
|
10
|
+
"size",
|
|
11
|
+
"trail",
|
|
12
|
+
"glow",
|
|
13
|
+
"duration",
|
|
14
|
+
"origin",
|
|
15
|
+
"followMouse",
|
|
16
|
+
"fps"
|
|
17
|
+
], n = {
|
|
18
|
+
name: "VueFireworks",
|
|
19
|
+
props: {
|
|
20
|
+
show: { type: Boolean, default: !1 },
|
|
21
|
+
count: { type: Number },
|
|
22
|
+
colors: { type: Array },
|
|
23
|
+
shape: { type: String, validator: (e) => ["rect", "circle", "star"].includes(e) },
|
|
24
|
+
gravity: { type: Number },
|
|
25
|
+
friction: { type: Number },
|
|
26
|
+
spread: { type: Number },
|
|
27
|
+
size: { type: Number },
|
|
28
|
+
trail: { type: Boolean },
|
|
29
|
+
glow: { type: Boolean },
|
|
30
|
+
duration: { type: Number },
|
|
31
|
+
origin: { type: [String, Object] },
|
|
32
|
+
followMouse: { type: Boolean },
|
|
33
|
+
fps: { type: Number }
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return { engine: null };
|
|
37
|
+
},
|
|
38
|
+
watch: {
|
|
39
|
+
show(e) {
|
|
40
|
+
e ? this.fire() : this.engine && this.engine.stop();
|
|
41
|
+
},
|
|
42
|
+
// 深层配置变化时同步给引擎
|
|
43
|
+
...s.reduce((e, t) => (e[t] = {
|
|
44
|
+
handler(i) {
|
|
45
|
+
this.engine && this.engine.setOptions({ [t]: i });
|
|
46
|
+
}
|
|
47
|
+
}, e), {})
|
|
48
|
+
},
|
|
49
|
+
mounted() {
|
|
50
|
+
this.engine = new o(this.$refs.canvas, this._engineOptions()), this.engine.onEnd = () => {
|
|
51
|
+
r(this, !1), this.$emit("end");
|
|
52
|
+
}, this.show && this.fire();
|
|
53
|
+
},
|
|
54
|
+
beforeDestroy() {
|
|
55
|
+
this.engine && this.engine.destroy(), this.engine = null;
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
_engineOptions() {
|
|
59
|
+
const e = {};
|
|
60
|
+
for (const t of s) {
|
|
61
|
+
const i = this[t];
|
|
62
|
+
i !== void 0 && (e[t] = i);
|
|
63
|
+
}
|
|
64
|
+
return e;
|
|
65
|
+
},
|
|
66
|
+
fire(e) {
|
|
67
|
+
this.engine && (this.$emit("start"), this.engine.fire(e));
|
|
68
|
+
},
|
|
69
|
+
stop() {
|
|
70
|
+
this.engine && this.engine.stop();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
render(e) {
|
|
74
|
+
return e("div", {
|
|
75
|
+
class: "fireworks-container",
|
|
76
|
+
style: {
|
|
77
|
+
position: "fixed",
|
|
78
|
+
inset: "0",
|
|
79
|
+
zIndex: "11",
|
|
80
|
+
pointerEvents: this.followMouse ? "none" : "auto"
|
|
81
|
+
}
|
|
82
|
+
}, [
|
|
83
|
+
e("canvas", {
|
|
84
|
+
ref: "canvas",
|
|
85
|
+
style: { width: "100%", height: "100%", display: "block" }
|
|
86
|
+
})
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
n.install = function(e) {
|
|
91
|
+
e.component(n.name, n);
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
n as default
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function i(t,e){t.$emit("update:show",e)}exports.emitUpdate=i;
|
package/dist/vue3.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),r=require("./engine.cjs"),a=require("./shared-shared-cjs.cjs"),o=["count","colors","shape","gravity","friction","spread","size","trail","glow","duration","origin","followMouse","fps"],n={name:"VueFireworks",props:{show:{type:Boolean,default:!1},count:{type:Number},colors:{type:Array},shape:{type:String,validator:e=>["rect","circle","star"].includes(e)},gravity:{type:Number},friction:{type:Number},spread:{type:Number},size:{type:Number},trail:{type:Boolean},glow:{type:Boolean},duration:{type:Number},origin:{type:[String,Object]},followMouse:{type:Boolean},fps:{type:Number}},emits:["update:show","start","end"],data(){return{engine:null}},watch:{show(e){e?this.fire():this.engine&&this.engine.stop()},...o.reduce((e,t)=>(e[t]={handler(i){this.engine&&this.engine.setOptions({[t]:i})}},e),{})},mounted(){this.engine=new r.FireworksEngine(this.$refs.canvas,this._engineOptions()),this.engine.onEnd=()=>{a.emitUpdate(this,!1),this.$emit("end")},this.show&&this.fire()},beforeUnmount(){this.engine&&this.engine.destroy(),this.engine=null},methods:{_engineOptions(){const e={};for(const t of o){const i=this[t];i!==void 0&&(e[t]=i)}return e},fire(e){this.engine&&(this.$emit("start"),this.engine.fire(e))},stop(){this.engine&&this.engine.stop()}},render(){return s.h("div",{class:"fireworks-container",style:{position:"fixed",inset:"0",zIndex:"11",pointerEvents:this.followMouse?"none":"auto"}},[s.h("canvas",{ref:"canvas",style:{width:"100%",height:"100%",display:"block"}})])}};n.install=function(e){e.component(n.name,n)};exports.default=n;
|
package/dist/vue3.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** 粒子形状 */
|
|
2
|
+
export type FireworksShape = 'rect' | 'circle' | 'star'
|
|
3
|
+
|
|
4
|
+
/** 绽放原点:'center' 或 canvas 内的 CSS 像素坐标 */
|
|
5
|
+
export type FireworksOrigin = 'center' | { x: number; y: number }
|
|
6
|
+
|
|
7
|
+
/** 所有可配置项(props 与 engine options 共用) */
|
|
8
|
+
export interface FireworksOptions {
|
|
9
|
+
/** 每轮粒子数,默认 60 */
|
|
10
|
+
count?: number
|
|
11
|
+
/** 颜色池,默认 ['#FF8201','#2DA6E0','#FF262B'] */
|
|
12
|
+
colors?: string[]
|
|
13
|
+
/** 粒子形状,默认 'rect' */
|
|
14
|
+
shape?: FireworksShape
|
|
15
|
+
/** 重力加速度(px/frame²),默认 0.12 */
|
|
16
|
+
gravity?: number
|
|
17
|
+
/** 空气阻力(速度衰减系数),默认 0.985 */
|
|
18
|
+
friction?: number
|
|
19
|
+
/** 爆炸初速度上限,默认 5 */
|
|
20
|
+
spread?: number
|
|
21
|
+
/** 粒子尺寸(px),默认 4 */
|
|
22
|
+
size?: number
|
|
23
|
+
/** 拖尾残影,默认 false */
|
|
24
|
+
trail?: boolean
|
|
25
|
+
/** 发光,默认 false */
|
|
26
|
+
glow?: boolean
|
|
27
|
+
/** 粒子最大寿命(帧),默认 90 */
|
|
28
|
+
duration?: number
|
|
29
|
+
/** 绽放原点,默认 'center' */
|
|
30
|
+
origin?: FireworksOrigin
|
|
31
|
+
/** 跟随鼠标(优先级高于 origin),默认 false */
|
|
32
|
+
followMouse?: boolean
|
|
33
|
+
/** 帧率,默认 60 */
|
|
34
|
+
fps?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Vue 组件实例上暴露的命令式方法 */
|
|
38
|
+
export interface VueFireworksInstance {
|
|
39
|
+
/** 手动触发一轮,可临时覆盖配置 */
|
|
40
|
+
fire(overrides?: FireworksOptions): void
|
|
41
|
+
/** 立即停止并清空 */
|
|
42
|
+
stop(): void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const VueFireworks: {
|
|
46
|
+
name: string
|
|
47
|
+
install(app: any): void
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default VueFireworks
|
package/dist/vue3.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { h as s } from "vue";
|
|
2
|
+
import { FireworksEngine as r } from "./engine.js";
|
|
3
|
+
import { e as a } from "./shared-shared-es.js";
|
|
4
|
+
const o = [
|
|
5
|
+
"count",
|
|
6
|
+
"colors",
|
|
7
|
+
"shape",
|
|
8
|
+
"gravity",
|
|
9
|
+
"friction",
|
|
10
|
+
"spread",
|
|
11
|
+
"size",
|
|
12
|
+
"trail",
|
|
13
|
+
"glow",
|
|
14
|
+
"duration",
|
|
15
|
+
"origin",
|
|
16
|
+
"followMouse",
|
|
17
|
+
"fps"
|
|
18
|
+
], n = {
|
|
19
|
+
name: "VueFireworks",
|
|
20
|
+
props: {
|
|
21
|
+
show: { type: Boolean, default: !1 },
|
|
22
|
+
count: { type: Number },
|
|
23
|
+
colors: { type: Array },
|
|
24
|
+
shape: { type: String, validator: (e) => ["rect", "circle", "star"].includes(e) },
|
|
25
|
+
gravity: { type: Number },
|
|
26
|
+
friction: { type: Number },
|
|
27
|
+
spread: { type: Number },
|
|
28
|
+
size: { type: Number },
|
|
29
|
+
trail: { type: Boolean },
|
|
30
|
+
glow: { type: Boolean },
|
|
31
|
+
duration: { type: Number },
|
|
32
|
+
origin: { type: [String, Object] },
|
|
33
|
+
followMouse: { type: Boolean },
|
|
34
|
+
fps: { type: Number }
|
|
35
|
+
},
|
|
36
|
+
emits: ["update:show", "start", "end"],
|
|
37
|
+
data() {
|
|
38
|
+
return { engine: null };
|
|
39
|
+
},
|
|
40
|
+
watch: {
|
|
41
|
+
show(e) {
|
|
42
|
+
e ? this.fire() : this.engine && this.engine.stop();
|
|
43
|
+
},
|
|
44
|
+
...o.reduce((e, t) => (e[t] = {
|
|
45
|
+
handler(i) {
|
|
46
|
+
this.engine && this.engine.setOptions({ [t]: i });
|
|
47
|
+
}
|
|
48
|
+
}, e), {})
|
|
49
|
+
},
|
|
50
|
+
mounted() {
|
|
51
|
+
this.engine = new r(this.$refs.canvas, this._engineOptions()), this.engine.onEnd = () => {
|
|
52
|
+
a(this, !1), this.$emit("end");
|
|
53
|
+
}, this.show && this.fire();
|
|
54
|
+
},
|
|
55
|
+
beforeUnmount() {
|
|
56
|
+
this.engine && this.engine.destroy(), this.engine = null;
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
_engineOptions() {
|
|
60
|
+
const e = {};
|
|
61
|
+
for (const t of o) {
|
|
62
|
+
const i = this[t];
|
|
63
|
+
i !== void 0 && (e[t] = i);
|
|
64
|
+
}
|
|
65
|
+
return e;
|
|
66
|
+
},
|
|
67
|
+
fire(e) {
|
|
68
|
+
this.engine && (this.$emit("start"), this.engine.fire(e));
|
|
69
|
+
},
|
|
70
|
+
stop() {
|
|
71
|
+
this.engine && this.engine.stop();
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
render() {
|
|
75
|
+
return s("div", {
|
|
76
|
+
class: "fireworks-container",
|
|
77
|
+
style: {
|
|
78
|
+
position: "fixed",
|
|
79
|
+
inset: "0",
|
|
80
|
+
zIndex: "11",
|
|
81
|
+
pointerEvents: this.followMouse ? "none" : "auto"
|
|
82
|
+
}
|
|
83
|
+
}, [
|
|
84
|
+
s("canvas", {
|
|
85
|
+
ref: "canvas",
|
|
86
|
+
style: { width: "100%", height: "100%", display: "block" }
|
|
87
|
+
})
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
n.install = function(e) {
|
|
92
|
+
e.component(n.name, n);
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
n as default
|
|
96
|
+
};
|