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

    你可能感兴趣的文章
    pandas :to_excel() float_format
    查看>>
    pandas :从数据透视表中的另一列中减去一列
    查看>>
    pandas :加入有条件的数据框
    查看>>
    pandas :将多列汇总为一列,没有最后一列
    查看>>
    pandas :将时间戳转换为 datetime.date
    查看>>
    pandas :将行取消堆叠到新列中
    查看>>
    pandas :设置编号.最大行数
    查看>>
    pandas DataFrame 中的自定义浮点格式
    查看>>
    Pandas DataFrame 的 describe()方法详解-ChatGPT4o作答
    查看>>
    Pandas DataFrame中删除列级的方法链接解决方案
    查看>>
    Pandas DataFrame中的列从浮点数输出到货币(负值)
    查看>>
    Pandas DataFrame中的列从浮点数输出到货币(负值)
    查看>>
    Pandas DataFrame多索引透视表-删除空头和轴行
    查看>>
    pandas DataFrame的一些操作
    查看>>
    Pandas Dataframe的日志文件
    查看>>
    Pandas df.iterrows() 并行化
    查看>>