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

    你可能感兴趣的文章
    phpMailer发送邮件
    查看>>
    PHPMailer发送邮件
    查看>>
    phpmailer发送邮件,可以带附件
    查看>>
    phpmailer的用法
    查看>>
    phpMQTT
    查看>>
    phpmyadmin 安装
    查看>>
    phpmyadmin导出数据库出现Fatal error: Cannot 'break' 2 levels in D:\phpstudy\WWW\phpMyAdmin
    查看>>
    phpmyadmin数据库建表及插入
    查看>>
    phpnow配置
    查看>>
    phprpc简单使用
    查看>>
    phpspider中当爬虫获取数据时如何去掉广告
    查看>>
    phpstorm 2016.3.3 激活
    查看>>
    phpstorm中Xdebug的使用
    查看>>
    phpstorm中使用svn版本控制器
    查看>>
    PHPStorm使用git
    查看>>
    PHPstorm最常用的快捷键,提高开发效率
    查看>>
    Redis五种数据结构
    查看>>
    phpstorm配置php脚本执行
    查看>>
    PhpStorm配置远程xdebug
    查看>>
    phpstudy+iis搭建php项目
    查看>>