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

    你可能感兴趣的文章
    PyQt:如何使用QAxWidget引用发送参数
    查看>>
    PyQt:我可以制作一个带有图标和文本的工具栏按钮吗?
    查看>>
    pyscopg2:是否可以在循环中动态添加 %s
    查看>>
    Pyserial 缓冲区的填充速度比我读的快
    查看>>
    PySpark - 在数据框中求和一列并将结果返回为 int
    查看>>
    pyspark On Yarn 的模块依赖问题
    查看>>
    PySpeech(Python)-转录MP3文件?
    查看>>
    Pyspider WebUI 未授权访问致远程代码执行漏洞复现
    查看>>
    pyspider爬虫学习-文档翻译-Architecture.md
    查看>>
    pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
    查看>>
    Pytesseract集字符白名单
    查看>>
    PyTorch DataLoader 报错 Segmentation fault (core dumped) 的原因及解决方案
    查看>>
    Pytest ------ 标记函数
    查看>>
    Pytest Fixture的妙用:深度解析范围和实际运用!
    查看>>
    Pytest monkeypatch不适用于导入的函数
    查看>>
    Pytest 命令行报错: Hint: make sure your test modules/packages have valid Python names.
    查看>>
    pytest 的 request fixture:实现个性化测试需求
    查看>>
    Pytest+Allure 接口自动化测试平台开发实战
    查看>>
    pytest+allure使用动态级别,参数化severity
    查看>>
    Pytest+Unittest+Git+Jenkins企业级CICD自动化测试平台建设方案
    查看>>