博客
关于我
微信小程序动画效果方法封装
阅读量: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 map三要素(view,target,layers),及其他参数属性方法介绍
    查看>>
    Openlayers Map事件基础及重点内容讲解
    查看>>
    Openlayers Overlay基础及重点内容讲解
    查看>>
    Openlayers Select的用法、属性、方法、事件介绍
    查看>>
    Openlayers Source基础及重点内容讲解
    查看>>
    Openlayers view三要素(zoom,center,projection)及其他参数属性方法介绍
    查看>>
    OpenLayers 入门使用
    查看>>
    Openlayers 入门教程(一):应该如何学习 Openlayers
    查看>>
    openlayers 入门教程(七):Interactions 篇
    查看>>
    openlayers 入门教程(三):view 篇
    查看>>
    openlayers 入门教程(九):overlay 篇
    查看>>
    openlayers 入门教程(二):map 篇
    查看>>
    openlayers 入门教程(五):sources 篇
    查看>>
    openlayers 入门教程(八):Geoms 篇
    查看>>
    openlayers 入门教程(六):controls 篇
    查看>>
    openlayers 入门教程(十一):Formats 篇
    查看>>
    openlayers 入门教程(十三):动画
    查看>>
    openlayers 入门教程(十二):定位与轨迹
    查看>>
    openlayers 入门教程(十五):与 canvas、echart,turf 等交互
    查看>>
    openlayers 入门教程(十四):第三方插件
    查看>>