更新记录
0.0.7(2025-02-25)
0.0.6(2024-11-28)
0.0.5(2024-11-22)
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 4.52 app-vue app-uvue |
× |
√ |
√ |
√ |
√ |
√ |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
鸿蒙元服务 |
× |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
√ |
√ |
√ |
√ |
√ |
× |
√ |
× |
× |
lime-confetti 彩纸特效
安装
插件市场导入即可
文档
彩纸特效
代码演示
使用
- 提供简单的使用示例,更多请查看下方的demo
- app 存在通讯损耗,可以加上
renderjs
这个属性使用renderjs渲染
<view style="height: 750rpx;">
<l-confetti ref="confettiRef" @done="done"></l-confetti>
</view>
<button @click="run1">basice cannon</button>
const confettiRef = ref(null)
const run1 = () => {
confettiRef.value.play({
particleCount: 100,
spread: 70,
shapes: ['circle'],
origin: {
y: 0.6
}
})
}
const done = () => {
console.log('礼炮播放完毕')
}
Uvue
<view style="height: 750rpx;">
<l-confetti ref="confettiRef" @done="done"></l-confetti>
</view>
<button @click="run1">basice cannon</button>
import type { ConfettiOptions } from '@/uni_modules/lime-confetti'
const confettiRef = ref<LConfettiComponentPublicInstance|null>(null);
const done = ()=>{
console.log('完成了!')
}
const run1 = () => {
confettiRef.value?.play?.({
particleCount: 100,
spread: 70,
shapes: ['circle'],
origin: {
y: 0.6,
x: 0.5
}
} as ConfettiOptions)
}
查看示例
// 代码位于 uni_modules/lime-confetti/compoents/lime-confetti
<lime-confetti />
插件标签
- 默认 l-confetti 为 component
- 默认 lime-confetti 为 demo
关于vue2的使用方式
<view style="height: 750rpx;">
<l-confetti ref="confettiRef" @done="done"></l-confetti>
</view>
<button @click="run1">basice cannon</button>
const run1 = () => {
this.$refs.confettiRef.play({
particleCount: 100,
spread: 70,
shapes: ['circle'],
origin: {
y: 0.6
}
})
}
const done = () => {
console.log('礼炮播放完毕')
}
API
Events
Expose
参数 |
说明 |
参数 |
play(options) |
播放, options 为参数对象 |
|
OPtions
参数 |
说明 |
默认值 |
particleCount |
纸屑数量 |
50 |
angle |
发射角度 |
90 |
spread |
偏离 |
45 |
startVelocity |
速度 |
45 |
decay |
衰变 |
0.9 |
gravity |
重力 |
1 |
drift |
漂移 |
0 |
ticks |
移动次数 |
200 |
origin |
开始发射坐标 |
{x: 0.5,y:0.5} |
colors |
颜色数组,只支持HEX |
[] |
shapes |
形状,可选 square ,circle ,star |
混合 |
scalar |
每个纸宵的缩放因子 |
1 |
打赏
如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。
