当前位置:网站首页>wx-wow(微信小程序动效库)
wx-wow(微信小程序动效库)
2022-08-02 12:53:00 【InfoQ】
wx-wow
>2.5下载
gitwx-wowsrcgit clone https://github.com/Five-great/wx-wow.git
npmcnpm 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
使用
srcutilswxWOW.jswxWOW.wxsswxWOW.wxssapp.jswxWOW.js Page = require('./utils/wxWOW')
App({
...
})
app.wxsswxWOW.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-namedata-wx-wow-delay data-wx-wow-durationdata-wx-wow-offsetdata-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-namedata-wx-wow-namewxWOWTap <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-outNamedata-wx-wow-namedata-wx-wow-outDelaydata-wx-wow-delaydata-wx-wow-outDurationdata-wx-wow-durationdata-wx-wow-outIterationdata-wx-wow-iteration设置页面重复动效 (进入页面重新刷新执行动效)
Page({
data: {
wxwowConfig: {
repeat: true //是否重复刷新开启动画 默认 true , 当设为 false,则该页面未销毁前,只会执行一次动效
}
}
})
其他设置
classwxwow-repeat <view class=" {{wx.WOW()}} wxwow-repeat " data-wx-wow-name="bounceInUp" data-wx-wow-id="{{wx.WOWId()}}" catchtap="{{wx.WOWOut}}" > ... </view>
classwxwow-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
边栏推荐
- js九宫格样式抽奖插件
- 图神经网络(GNN)的简介「建议收藏」
- js semi-circle loading progress animation js special effects
- Taurus.MVC V3.0.3 微服务开源框架发布:让.NET 架构在大并发的演进过程更简单。
- ThinkPHP 5.1反序列化分析和poc
- pig4cloud服务架构使用
- FreeRTOS experiment--one function creates multiple tasks
- Data Lake (2): What is Hudi
- Pod调度策略:亲和性、污点与污点容忍
- Detailed explanation of network flow (what information can the flow network diagram generally reflect)
猜你喜欢

Intouch Historian历史曲线配置导入导出

FreeRTOS experiment -- delete task

图论之Kruskal,最小生成树如何优雅解题?

Speed up your programs with bitwise operations

水平垂直居中方式

liunx基础命令讲解

How to better assess credit risk?Just watch this scorecard model live

Import and export data of SQL Server database

ETL(二):表达式组件的使用

FreeRTOS experiment--one function creates multiple tasks
随机推荐
PGSQL database to realize the import and export
MyCat2 introduction and installation and basic use
分享一个Chrome控制台数据获取的例子
JS中的闭包
The 7 most commonly used data analysis thinking, solve 95% of the analysis problems
无线振弦采集仪远程修改参数方式
图论之Floyd,多源图最短路如何暴力美学?
新特性解读 | MySQL 8.0 GIPK 不可见主键
ssm访问数据库数据报错
FreeRTOS实验--删除任务
数据湖(二):什么是Hudi
RESTful 风格(详细介绍 + 案例实现)
Import and export data of SQL Server database
Introduction to Graph Neural Networks (GNN) "Recommended Collection"
Chapter 11 Documents
PHP+MYSQL [Student Information Management System] (Minimalist Edition)
Intelligent Image Analysis-Intelligent Home Appliance Image Target Detection Statistical Counting Detection and Recognition-iCREDIT
Seata分布式事务
网络流详解(流网图一般能够反映什么信息)
Data Lake (2): What is Hudi