博客
关于我
微信小程序动画效果方法封装
阅读量: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.如何在QTableView中插入小部件
    查看>>
    PyQt4 代码在 PyQt5 (QHeaderView) 上不起作用
    查看>>
    PyQt4 到 PyQt5 ->mainFrame() 已弃用,需要修复才能加载网页
    查看>>
    PyQt4, class:mouseButtons用法
    查看>>
    PyQt4参考文档
    查看>>
    PyTorch Lightning:通过分布式训练扩展深度学习工作流
    查看>>
    PyQt5 - QThread:在线程仍在运行时被销毁
    查看>>
    PyQt5 - 如何从工作线程发出信号以通过 GUI 线程调用事件
    查看>>
    PyQt5 Designer 不工作:此应用程序无法启动,因为无法初始化 Qt 平台插件
    查看>>
    PyQt5 QLCNumber 没有更新
    查看>>
    PyQt5 TabWidget选项卡BarClicked TypeError:本机Qt信号不可调用
    查看>>
    PyQt5 从 PyQt4 转换信号代码
    查看>>
    PyQt5 和 asyncio:从永不完成的收益
    查看>>
    PyQt5 和 Django:如何使用 HTTP 请求(Multipart-form)上传图像?
    查看>>
    PyQt5 按钮运行功能和更新 LCD
    查看>>
    pyqt5 获取Qlabel中的图片并对其进行处理(包括Qimage转换为Mat)
    查看>>
    pyqt5 设置控件在最上层或者在下层
    查看>>
    pyqt5 设置网格布局的间距
    查看>>
    pyTorch Hub 系列#4:PGAN — GAN 模型
    查看>>
    PyQt5-基本窗口控件-QMainWindow
    查看>>