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

    你可能感兴趣的文章
    Oracle 在Drop表时的Cascade Constraints
    查看>>
    Oracle 在Sqlplus 执行sql脚本文件。
    查看>>
    Oracle 如何处理CLOB字段
    查看>>
    oracle 学习
    查看>>
    oracle 定义双重循环例子
    查看>>
    ORACLE 客户端工具连接oracle 12504
    查看>>
    Oracle 客户端连接时报ORA-01019错误总结
    查看>>
    oracle 导出sql数据库表结构,使用sql developer 导出Oracle数据库中的表结构
    查看>>
    oracle 嵌套表 例子,Oracle之嵌套表(了解)
    查看>>
    Oracle 常用命令
    查看>>
    Oracle 常用的V$视图脚本(二)
    查看>>
    Oracle 并行原理与示例总结
    查看>>
    oracle 并集 时间_Oracle集合运算符 交集 并集 差集
    查看>>
    Oracle 序列sequence 开始于某个值(10)执行完nextval 发现查出的值比10还小的解释
    查看>>
    ORACLE 异常错误处理
    查看>>
    oracle 执行一条查询语句,把数据加载到页面或者前台发生的事情
    查看>>
    oracle 批量生成建同义词语句和付权语句
    查看>>
    oracle 抓包工具,shell 安装oracle和pfring(抓包) 及自动环境配置
    查看>>
    Oracle 拆分以逗号分隔的字符串为多行数据
    查看>>
    Oracle 排序中使用nulls first 或者nulls last 语法
    查看>>