博客
关于我
微信小程序动画效果方法封装
阅读量:236 次
发布时间:2019-02-28

本文共 1870 字,大约阅读时间需要 6 分钟。

??????????????????????????????????????

?WXML???????

??????????????????WXML?????????????????????????????????view?div?????animation?????????????????

????????bindtap????????????

???????animation????????????????????{}????????????

?JavaScript?????

????????????JavaScript?????????.js????????wx.createAnimation???????????????????????????????

?????????????????

function bindViewTap() {    var animation = wx.createAnimation({        duration: 3000, // ??????        timingFunction: 'linear', // ??????        delay: 0, // ??????        transformOrigin: '50%,50%,0' // ???????    });    // ??????    animation.rotate(360).scale(2).translate(10, -20).step();    animation.rotate(-360).scale(1).translate(0).step();    // ??????    this.setData({        animationData: animation.export()    });}

??????

????????????????animation???????????????????????????????????????

animation.rotate(360).scale(2).translate(10, -20).step();// ??????360???????????????10?????-20????????????????

???????????????????????????????????????

???????

?????????????????????????????????????????????app.js????????getApp()??????????????

?????????????

// app.jsfunction slideUpShow(that, animationName, px, opacity) {    var animation = wx.createAnimation({        duration: 800,        timingFunction: 'ease'    });    animation.translateY(px).opacity(opacity).step();        // ???????????animationName    var json = '{"' + animationName + '":""}';    json = JSON.parse(json);    json[animationName] = animation.export();        that.setData(json);}

???????????????

// pages/index/index.jsthis.app.slideUpShow(this, 'firstSlideUp', -200, 1);setTimeout(function() {    this.app.slideUpShow(this, 'secondSlideUp', -200, 1);}.bind(this), 200);

????

  • ???????????????????????????????????????????????
  • ???????????????????????????????
  • ?????????????????????????????????????????
  • ??????????????????????????????????

    转载地址:http://pasp.baihongyu.com/

    你可能感兴趣的文章
    php url路径问题和php文件以绝对路径引入
    查看>>
    PHP WebSehll 后门脚本与检测工具
    查看>>
    ReentrantLock源码解析
    查看>>
    PHP XSS攻击防范--如何过滤用户输入
    查看>>
    php zookeeper实现分布式锁
    查看>>
    PHP 中 this,self,parent 的区别、用法
    查看>>
    PHP 中如何高效地处理大规模数据的排序?
    查看>>
    PHP 之ftp客户端类封装实现
    查看>>
    php 代码改进
    查看>>
    php 代码混淆
    查看>>
    PHP 使用 $_SERVER['PHP_SELF'] 获取当前页面地址及其安全性问题
    查看>>
    Redis系列之如何避免缓存击穿
    查看>>
    php 内存分析
    查看>>
    PHP 函数名前面加&
    查看>>
    redis报错
    查看>>
    php 删除包含某一字符的数组元素
    查看>>
    Redis学习总结(19)——Redis 5种集群方式对比
    查看>>
    php 反射
    查看>>
    php 处理 大并发
    查看>>
    php 大文件上传
    查看>>