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

    你可能感兴趣的文章
    php自定义函数: 文件大小转换成智能形式
    查看>>
    php英语单词,php常用英语单词,快速学习php编程英语(6)
    查看>>
    R3.4.0安装包时报错“需要TRUE/FALSE值的地方不可以用缺少值”,需升级到R3.5.0
    查看>>
    PHP获取curl传输进度
    查看>>
    PHP获取IP所在地区(转)
    查看>>
    PHP获取IP的方法对比
    查看>>
    php获取json里面内容
    查看>>
    R2的版本由来
    查看>>
    PHP获取图片宽度高度、大小尺寸、图片类型、用于布局的img属性
    查看>>
    PHP获取当前文件的绝对路径
    查看>>
    PHP获取当前时间、时间戳的各种格式写法汇总
    查看>>
    PHP获取当前页面的完整URL
    查看>>
    php获取数据库中数据生成json,中文乱码问题的解决方案
    查看>>
    php获取文件夹中文件的两种方法
    查看>>
    PHP获取日期的一些方法总结
    查看>>
    R2学习记录
    查看>>
    PHP获取本周的每一天的时间
    查看>>
    php获取用户真实IP和防刷机制
    查看>>
    php获取网页内容的三种方法
    查看>>
    R-CNN算法优化策略
    查看>>