博客
关于我
微信小程序动画效果方法封装
阅读量: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/

    你可能感兴趣的文章
    R&Python Data Science 系列:数据处理(1)
    查看>>
    php错误日志文件
    查看>>
    PHP错误解决:Array and string offset access syntax with curly braces is deprecated
    查看>>
    php隐藏手机号中间4位方法总结
    查看>>
    php面向对象三大特征封装、多态、继承
    查看>>
    php面向对象全攻略
    查看>>
    php面向对象的基础题
    查看>>
    php面试题二--解决网站大流量高并发方案(从url到硬盘来解决高并发方案总结)...
    查看>>
    php页面增加自选项,php-在Woocommerce中添加新的自定义默认订购目录选项
    查看>>
    php页面静态化技术;学习笔记
    查看>>
    php项目心得以及总结
    查看>>
    R&Python Data Science 系列:数据处理(4)长宽格式数据转换
    查看>>
    PHP项目集成支付宝PC端扫码支付API(国内支付)
    查看>>
    php预定义常量&变量
    查看>>
    R 集成算法③ 随机森林
    查看>>
    php验证码背景色设置无效
    查看>>
    php验证邮箱是否有效
    查看>>
    PHP高性能分布式应用服务器框架-SwooleDistributed
    查看>>
    PHP高效、轻量级表格数据处理库 OpenSpout
    查看>>
    R 数据缺失的处理
    查看>>