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

    你可能感兴趣的文章
    PyTorch之torch.utils.data.DataLoader解读
    查看>>
    PyTorch之DataLoader杂谈
    查看>>
    presto、druid、sparkSQL、kylin的对比分析
    查看>>
    Presto分布式大数据查询引擎
    查看>>
    Presto架构及原理
    查看>>
    Presto(一)集群部署
    查看>>
    Presto(二)开启安全认证
    查看>>
    Pricing procedure Steps and Details in SAP MM (from SCN)
    查看>>
    Prim 算法在不同权重范围内的性能分析及其实现
    查看>>
    Primace 5.0软件与KEIL单片机软件联合在线仿真步骤
    查看>>
    Prime Distance
    查看>>
    Prim求MST最小生成树
    查看>>
    Prim算法与Kruskal算法在均匀分布权重图中的性能比较
    查看>>
    Prim算法在加权连通图中的简单实现
    查看>>
    Prim算法详解及C代码示例
    查看>>
    pytorch中让数组显示更多的数字 torch.set_printoptions参数详解 numpy也是这个函数
    查看>>
    pringBoot Controller接收参数的几种常用方式
    查看>>
    printf()函数
    查看>>