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

    你可能感兴趣的文章
    PyCharm vs VSCode,是时候改变你的 IDE 了!
    查看>>
    PyCharm 中,“新建”(New)和“新建项目”(New Project)-ChatGPT4o作答
    查看>>
    PyCharm 代码编辑与调试运行详解
    查看>>
    Pycharm 出现 instantitaing tests 以及test session starts 的解决方法
    查看>>
    pytorch 固定随机种子
    查看>>
    Pycharm 对容器中的 Python 程序断点远程调试
    查看>>
    Pycharm 常用快捷键大全【快查字典版】
    查看>>
    Pycharm 常用快捷键大全,全网最全!
    查看>>
    PyCharm 常用的技巧完全指南
    查看>>
    PyCharm 快捷键与效率编码详解
    查看>>
    pycharm 怎么添加python依赖的包, requirements.txt文件如何导入python库
    查看>>
    PyCharm 插件工具使用
    查看>>
    PyCharm 搜索与导航栏详解
    查看>>
    PyCharm 搭建 Selenium + Python 的自动化测试环境
    查看>>
    PyCharm 数据库操作详解
    查看>>
    PyCharm 版本与管理详解
    查看>>
    PyCharm 界面排版详解
    查看>>
    pycharm 配置qt
    查看>>
    Pycharm+Django搭建第一个Python Web程序
    查看>>
    pycharm+pyqt5配置
    查看>>