当前位置:网站首页>wx-wow(微信小程序动效库)
wx-wow(微信小程序动效库)
2022-08-02 12:53:00 【InfoQ】
wx-wow
>2.5
下载
git
wx-wow
src
git clone https://github.com/Five-great/wx-wow.git
npm
cnpm
npm install --save wx-wow
+-- src
| |-- wxWOW.js
| |-- wxWOW.wxs
| |-- wxWOW.wxss
| |-- wxWOW.min.js
| |-- wxWOW.min.wxs
| |-- wxWOW.min.wxss
|-- package-lock.json
|-- package.json
+-- README.md
使用
src
utils
wxWOW.js
wxWOW.wxss
wxWOW.wxss
app.js
wxWOW.js
Page = require('./utils/wxWOW')
App({
...
})
app.wxss
wxWOW.wxss
/**app.wxss**/
@import "./utils/wxWOW.wxss";
wxWOW.wxs
"wx"
{{ wxwow }}
WOWChange
<wxs src="../../utils/wxWOW.wxs" module="wx" />
<view change:prop="{{wx.WOWChange}}" prop="{{wxwow}}" >
...
</view>
class
" {{wx.WOW()}} <动效名称>"
" {{wx.WOW()}} bounceInUp "
id
{{wx.WOWId()}}
data-wx-wow-id
//例子1:
<view class=" {{wx.WOW()}} bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" > ... </view>
额外参数
data-wx-wow-name
data-wx-wow-delay
data-wx-wow-duration
data-wx-wow-offset
data-wx-wow-iteration
<view class="{{wx.WOW()}} bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" data-wx-wow-delay="0.8s" data-wx-wow-offset="500" > ... </view>
<image src="xxxx.png" class="{{wx.WOW()}} swing" data-wx-wow-id="{{wx.WOWId()}}" data-wx-wow-delay="0.8s" data-wx-wow-offset="500" data-wx-wow-iteration="5" />
<view class="{{wx.WOW()}} fadeOut" data-wx-wow-id="{{wx.WOWId()}}" data-wx-wow-delay="0.8s" data-wx-wow-duration="3s" > ... </view>
升阶配置
class
" {{wx.WOW()}}"
<动效名>
id
{{wx.WOWId()}}
data-wx-wow-id
//例2:
<view class=" {{wx.WOW()}} " data-wx-wow-name="bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" > ... </view>
触发实现离场动效
wx.WOWOut()
data-wx-wow-name
data-wx-wow-name
wxWOWTap
<view class=" {{wx.WOW()}} " data-wx-wow-name="bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" catchtap="{{wx.WOWOut}}" > ... </view>
Page({
...
wxWOWTap: function(event){
console.log(event)
setTimeout(()=>{
event.target.dataset.idx?wx.navigateTo({url: '/pages/xxx/xxx?idx='+event.target.dataset.idx}):''
},600)
}
...
})
可选配置
data-wx-wow-outName
data-wx-wow-name
data-wx-wow-outDelay
data-wx-wow-delay
data-wx-wow-outDuration
data-wx-wow-duration
data-wx-wow-outIteration
data-wx-wow-iteration
设置页面重复动效 (进入页面重新刷新执行动效)
Page({
data: {
wxwowConfig: {
repeat: true //是否重复刷新开启动画 默认 true , 当设为 false,则该页面未销毁前,只会执行一次动效
}
}
})
其他设置
class
wxwow-repeat
<view class=" {{wx.WOW()}} wxwow-repeat " data-wx-wow-name="bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" catchtap="{{wx.WOWOut}}" > ... </view>
class
wxwow-once
<view class=" {{wx.WOW()}} wxwow-once" data-wx-wow-name="bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" catchtap="{{wx.WOWOut}}" > ... </view>
Demo
应用实列


欢迎 点赞 ,Fork , 提 Issues
边栏推荐
- LeetCode_377_组合总和Ⅳ
- ESP8266模块使用完整教程「建议收藏」
- openGauss数据库基本操作(超详细)
- How to turn off hardware acceleration [easy to understand]
- package.json与package-lock.json
- selenium chrome driver运行时的cannot determine loading status from target frame detached问题
- Data Lake (3): Hudi Concept Terminology
- uniapp/小程序 onload方法每次打开页面都执行解读
- LeetCode_139_单词拆分
- Oracle update误操作单表回滚
猜你喜欢
PHP+MYSQL【学生信息管理系统】(极简版)
LeetCode_377_Combination Sum IV
Openlayers Quick Start Tutorial
动态组件-component
SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution
Data Lake (2): What is Hudi
Manual architecture, Mysql interview 126 questions
qt 编译报错 No rule to make target
最小割和对偶图(未完成)
不错的射击类js小游戏源码
随机推荐
FreeRTOS--Priority Experiment
Pod调度策略:亲和性、污点与污点容忍
PGSQL database to realize the import and export
水平垂直居中方式
Chapter 11 Documents
Process finished with exit code 1
this的绑定指向详细解答
你知道图论的spfa吗?
Drools(8): WorkBench uses
Basic operations of openGauss database (super detailed)
pytorch model to tensorflow model
FreeRTOS--优先级实验
FreeRTOS experiment -- delete task
SQL Server2019安装步骤及脱机安装Microsoft机器学习组件下一步不能继续的问题
图论之Kruskal,最小生成树如何优雅解题?
Hand rolled architecture, 41 Redis interview asked
无线振弦采集仪远程修改参数方式
svg实现的树木四季变化
Taurus.MVC V3.0.3 Microservice Open Source Framework Released: Make the evolution of .NET architecture easier in large concurrency.
LeetCode_377_Combination Sum IV