博客
关于我
微信小程序动画效果方法封装
阅读量: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 面向对象 final类与final方法
    查看>>
    php+JQ+EasyUI自动加载数据
    查看>>
    php+sql server根据自增序号id区间查询第几条到第几条的数据
    查看>>
    php--------获取当前时间、时间戳
    查看>>
    Redis使用场景举例
    查看>>
    php--正则表达式
    查看>>
    php--防止sql注入的方法
    查看>>
    PHP-CGI Windows平台远程代码执行漏洞复现(CVE-2024-4577)
    查看>>
    php-cgi耗尽报502错误
    查看>>
    php-cgi(fpm-cgi) 进程 CPU 100% 与 file_get_content...
    查看>>
    PHP-DI/Invoker 开源项目使用教程
    查看>>
    php-fpm与Nginx运行常见错误说明
    查看>>
    php-fpm比php成为apache模块好在哪
    查看>>
    php-fpm超时时间设置request_terminate_timeout分析
    查看>>
    php-fpm进程数优化
    查看>>
    PHP-GD库-分类整理
    查看>>
    php-laravel框架用户验证(Auth)模块解析(一)
    查看>>
    php-laravel框架用户验证(Auth)模块解析(三)登录模块
    查看>>
    php-laravel框架用户验证(Auth)模块解析(二)注册模块
    查看>>