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

    你可能感兴趣的文章
    OCP题库升级,新版的052考试题及答案整理-18
    查看>>
    OCR:文字识别(最详细教程)
    查看>>
    OCR使用总结
    查看>>
    OCR识别:身份证信息加密传输
    查看>>
    octave错误-error: ‘squareThisNumber‘ undefined near line 1 column 1
    查看>>
    Octotree Chrome插件离线安装
    查看>>
    OCTO作为美团的高性能服务通信框架,究竟能不能称得上是杀手锏呢?
    查看>>
    OC中关于给NSString 赋 nil和@""的区别
    查看>>
    OC字符串方法汇总
    查看>>
    OC学习6——面相对象的三大特性
    查看>>
    OC点语法介绍和使用以及@property关键字
    查看>>
    oc知道经纬度求位置
    查看>>
    OC高效率52之提供“全能初始化”方法
    查看>>
    oc--习题
    查看>>
    oday!POC管理和漏洞扫描小工具
    查看>>
    ODBC的JAR包和PLSQL
    查看>>
    ODE网络:一场颠覆RNN的革命即将到来
    查看>>
    Odin 开源项目教程
    查看>>
    odoo14配置阿里云免费SSL证书
    查看>>
    odoo系统局域网及外网访问?快解析内网穿透方案教程
    查看>>