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

    你可能感兴趣的文章
    php安装扩展
    查看>>
    php实战第二十二天
    查看>>
    rabbitmq重启
    查看>>
    php实现上传(多个)文件函数封装
    查看>>
    php实现下载文件方法
    查看>>
    php实现单链表
    查看>>
    php实现图片背景换色功能
    查看>>
    php实现多个一维数组对应合并成二维数组
    查看>>
    php实现多关键字查找方法
    查看>>
    PHP实现微信公众号H5支付
    查看>>
    PHP实现微信公众号网页授权
    查看>>
    PHP实现微信小程序推送消息至公众号
    查看>>
    rabbitmq逻辑与开发
    查看>>
    php实现根据身份证获取年龄
    查看>>
    PHP实现的MongoDB数据增删改查
    查看>>
    PHP实现的SSO单点登录系统,拿走就用吧
    查看>>
    php实现短信验证功能
    查看>>
    RabbitMQ连接报错(1)—— None of the specified endpoints were reachable
    查看>>