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

    你可能感兴趣的文章
    Python Sympy模块NoConversion:收敛到根失败;请尝试n<;15或MaxSteps>;50
    查看>>
    Python sys.MODULES包含尚未导入的模块
    查看>>
    python sys模块使用
    查看>>
    Python tarfile、zipfile解压模块讲解
    查看>>
    python tcp server传输成功之后进行删除_python学习之路(三)使用socketserver进行ftp断点续传...
    查看>>
    python车牌识别系统+车辆管理+计费系统(图像识别)django框架 计算机毕业设计
    查看>>
    Python threading.Thread 只能使用私有方法 self.__Thread_stop() 停止
    查看>>
    python time模块
    查看>>
    Python Tkinter Multiple Windows 教程
    查看>>
    Python tkinter 中的多处理
    查看>>
    python tkinter 按钮颜色_Python3 tkinter基础 Button bg 按钮的背景颜色
    查看>>
    Python Tkinter 笔记本小部件
    查看>>
    Python Tkinter 网格复选框
    查看>>
    Python TLS版本匹配
    查看>>
    python车牌精确定位
    查看>>
    python try except finally_Python3基础 try-except-finally 的简单示例
    查看>>
    Python Turtle图形窗口不显示任何内容
    查看>>
    Python tweepy写入到sqlite3 db
    查看>>
    Python TypeError:格式字符串的参数不足
    查看>>
    Python UI自动化测试Page Objects企业级实战
    查看>>