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

    你可能感兴趣的文章
    Redis 限速器及问题
    查看>>
    php中高级基础知识点
    查看>>
    php中,如何将编译后的代码,反编译回去。
    查看>>
    php之aop实践
    查看>>
    PHP之APC缓存详细介绍(转)
    查看>>
    php之memcache,memcached
    查看>>
    php之引用
    查看>>
    PHP之数组和函数的基本教程
    查看>>
    UVa 10465 - Homer Simpson
    查看>>
    php九九乘法表加粗,PHP九九乘法表
    查看>>
    PHP二维数组将重复键值合并重组成三维数组
    查看>>
    PHP二维数组转换为一维数组
    查看>>
    PHP二维数组重组
    查看>>
    PHP交换两个变量值
    查看>>
    php代码执行完整流程介绍
    查看>>
    PHP代码格式化工具phpcf常见问题解决方案
    查看>>
    PHP使用3DES算法加密解密字符串
    查看>>
    PHP使用curl multi要注意的问题:每次使用curl multi同时并发多少请求合适
    查看>>
    php使用memcached扩展的一个BUG
    查看>>
    SpringBoot基础教程2-1-11 RestTemplate整合HttpClient
    查看>>