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

    你可能感兴趣的文章
    Postman如何生成接口文档
    查看>>
    Postman学习之常用断言
    查看>>
    postman导入curl内容
    查看>>
    postman居然是用electron开发的,我们来认识下这个框架吧
    查看>>
    postman常用公共函数
    查看>>
    Postman常见问题及解决方法
    查看>>
    PostMan怎样携带登录信息请求后台接口防止出现无法访问资源问题
    查看>>
    Postman接口传参案例
    查看>>
    postman接口功能测试
    查看>>
    Postman接口测试
    查看>>
    Postman接口测试
    查看>>
    Postman接口测试/接口自动化实战教程
    查看>>
    Postman接口测试之POST、GET请求方法
    查看>>
    Postman接口测试之Post、Get请求方法
    查看>>
    Postman接口测试之:添加Cookie伪造请求
    查看>>
    Postman接口测试企业级实战
    查看>>
    PostMan接口测试实战
    查看>>
    Postman接口测试实战讲解
    查看>>
    Postman接口测试工具安装部署与快速入门
    查看>>
    postman接口测试常见问题
    查看>>