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

    你可能感兴趣的文章
    PyQt5——装饰器信号与槽
    查看>>
    PyQt5——软件密码登陆跳转主界面
    查看>>
    PyQt5——通过信号与槽进行数据传输
    查看>>
    PyQt5“定时器不能从另一个线程启动“更改 QLabel 的大小时出错
    查看>>
    pyqt5不显示窗口
    查看>>
    pyqt5任意组件的拖拽问题
    查看>>
    PyQt5信号与槽学习笔记——自定义信号与槽(二)
    查看>>
    PyQt5学习笔记——信号与槽
    查看>>
    PyQt5开发暗黑风格的计时器
    查看>>
    pyqt5教程11:绘制外观
    查看>>
    pyqt5教程12:拖放功能
    查看>>
    pyqt5教程13:客户定制组件
    查看>>
    pyqt5教程6:信号和事件
    查看>>
    PyQt5教程7:布局Layout管理
    查看>>
    pyqt5教程8:对话框
    查看>>
    pyqt5教程9:Widgets组件
    查看>>
    PyQt5教程——组件(7)
    查看>>
    Pytest monkeypatch不适用于导入的函数
    查看>>
    Pytest 命令行报错: Hint: make sure your test modules/packages have valid Python names.
    查看>>
    pytest 的 request fixture:实现个性化测试需求
    查看>>