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

    你可能感兴趣的文章
    Openlayers中点击地图获取坐标并输出
    查看>>
    Openlayers中设置定时绘制和清理直线图层
    查看>>
    OpenLayers使用点要素作为标记
    查看>>
    Openlayers入门教程 --- 万字长篇
    查看>>
    Openlayers各组件默认的css样式
    查看>>
    Openlayers图文版实战,vue项目从0到1做基础配置
    查看>>
    VM16+ubuntu20.04+win10如何固定虚拟机的ip (固定IP)
    查看>>
    OpenLayers学习一:地图加载(以类为接口)
    查看>>
    OpenLayers学习三:地图旋转及地图跳转到某一点的方式(以类为接口)
    查看>>
    OpenLayers学习二:点标记的添加删除和修改(以类为接口)
    查看>>
    Openlayers实战教程学习大纲及引导
    查看>>
    Openlayers实战:drawstart,drawend 绘制交互应用示例
    查看>>
    Openlayers实战:extent介绍及实际应用
    查看>>
    Openlayers实战:LayerGroup添加删除显示隐藏
    查看>>
    Openlayers实战:loadstart和loadend事件
    查看>>
    Openlayers实战:modifystart、modifyend互动示例
    查看>>
    Openlayers实战:moveend事件,利用calculateExtent获取地图左上和右下的坐标
    查看>>
    Openlayers实战:overlay上播放视频
    查看>>
    Openlayers实战:select简介及select选择feature实战
    查看>>
    Openlayers实战:个性化比例尺
    查看>>