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

    你可能感兴趣的文章
    python+requests+unittest执行自动化接口测试!
    查看>>
    Python+Requests编码识别Bug
    查看>>
    python函数编写_[零基础学python]传说中的函数编写条规
    查看>>
    Python+selenium —— UI自动化之鼠标操作
    查看>>
    python函数注释,参数后面加冒号:,函数后面的箭头→是什么?
    查看>>
    Python+Selenium+Threading进行兼容性测试
    查看>>
    Python+selenium+unittest的GUI自动化框架实现
    查看>>
    python函数拟合不规则曲线_Python计算&绘图——曲线拟合问题(转)
    查看>>
    python函数定义的基本格式_零基础学python-2.19 定义函数、调用函数与默认参数
    查看>>
    Python+Selenium之数据驱动测试的实现
    查看>>
    python函数定义与使用+返回值简解
    查看>>
    Python+Selenium登录
    查看>>
    Python日期时间模块
    查看>>
    Python函数合集:足足68个内置函数请收好!
    查看>>
    Python+Selenium自动化测试项目实战
    查看>>
    Python+Selenium自动化测试项目实战【建议收藏】
    查看>>
    Python+Selenium自动化测试:Page Object模式
    查看>>
    python+selenium进行cnblog的自动化登录测试
    查看>>
    Python函数只返回第一个值而不是数据框
    查看>>
    Python+SQL实战:京东用户行为数据分析案例解析(上)
    查看>>