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

    你可能感兴趣的文章
    pyhton验证码识别
    查看>>
    PyInstaller 中的 Kivy Garden - 试图跟踪导入
    查看>>
    Pyinstaller 和 PyQt5 macOS Mojave 兼容性问题
    查看>>
    pytorch tensor灰度图和RGB图相互转换的三种方法
    查看>>
    pyinstaller 打包资源文件
    查看>>
    PyInstaller 构建的 Windows EXE 因多处理而失败
    查看>>
    Pyinstaller--Windowed或--noconsole.exe不允许打开chromedriver
    查看>>
    Pyinstaller依赖项的许可证
    查看>>
    PyInstaller可执行文件找不到包含的flASK-COMPRESS
    查看>>
    Pyinstaller和海运
    查看>>
    PyInstaller图标选项在Mac上不起作用
    查看>>
    pyinstaller的使用
    查看>>
    pyinstaller超级加密 (加壳和转c)
    查看>>
    pyinstaller错误:OSError:找不到Python库:libpython3.4mu.so.1.0、libpython3.4m.so.1.0、libpython3.4.so.1.0
    查看>>
    Pyinstaller:‘;Fiona‘;没有属性‘;_loading‘;(很可能是由于循环导入)
    查看>>
    pyinstaller:更改应用程序图标
    查看>>
    Pylint“未解决的导入“;Visual Studio 代码中的错误
    查看>>
    pyLoad远程代码执行漏洞复现(CVE-2023-0297)
    查看>>
    pymongo update_one(),upsert=True,不使用$运算符
    查看>>
    pymongo 中的快速或批量更新
    查看>>