博客
关于我
微信小程序动画效果方法封装
阅读量: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查最大值,在PHP数组中查找最大值
    查看>>
    php标签筛选,关于PHP CodeIgniter框架中通过<a>标签和url做多条件分类筛选
    查看>>
    php根据年月日计算年龄
    查看>>
    RabbitMQ - 单机部署(超详细)
    查看>>
    php检查注册,PHP检查注册的电子邮件地址是一个’school.edu’地址
    查看>>
    php模拟发送GET和POST请求
    查看>>
    RabbitMQ - 以 MQ 为例,手写一个 RPC 框架 demo
    查看>>
    php模板引擎smarty
    查看>>
    php正则表达式模式
    查看>>
    php正则表达式的特殊字符含义
    查看>>
    PHP正则表达式获取武汉市的实时pm2.5数据并邮件发送phpmailer
    查看>>
    RabbitMQ + JMeter组合,优化你的中间件处理方式!
    查看>>
    PHP水仙花问题解法之一
    查看>>
    php没有解析是怎么回事,linux下php文件没有被剖析怎么办?_后端开发
    查看>>
    php注册页面实现注册后跳转页面
    查看>>
    PHP消息队列的实现方式与详解,值得一看
    查看>>
    PHP混合Go协程并发
    查看>>
    php源码中如何添加滚动公告,给WordPress网站添加滚动公告的方法
    查看>>
    PHP源码安装后如何新增模块
    查看>>