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

    你可能感兴趣的文章
    python列表去重复后按照顺序_从包含不可共元素的Python列表中删除重复元素,同时保留顺序?...
    查看>>
    python列表前几个_python之列表
    查看>>
    python列表元组
    查看>>
    Python列表/元组/字典和集合使用
    查看>>
    python列表 行列选择_python_pandas_dataframe_行列选择_切片操作
    查看>>
    python列表
    查看>>
    python列出当前目录、子目录和文件的脚本
    查看>>
    python+flask计算机毕业设计骨科门诊患者档案管理系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校体测管理系统的设计与实现(程序+开题+论文)
    查看>>
    Python切片对象和__getitem__
    查看>>
    python+flask计算机毕业设计高校体育竞赛成绩管理系统的设计与实现(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校体育赛事系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校体育运动会比赛系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校危化品管理系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校团委事务管理系统(程序+开题+论文)
    查看>>
    Python切片(%s)
    查看>>
    python+flask计算机毕业设计高校学生选课系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校学生饮食推荐系统(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校教务管理系统设计与实现(程序+开题+论文)
    查看>>
    python+flask计算机毕业设计高校教务管理系统(程序+开题+论文)
    查看>>