博客
关于我
微信小程序动画效果方法封装
阅读量: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 E-Business Suite软件 任意文件上传漏洞(CVE-2022-21587)
    查看>>
    Oracle EBS OPM 发放生产批
    查看>>
    Oracle EBS-SQL (BOM-15):检查多层BOM(含common BOM).sql
    查看>>
    Oracle EBS环境下查找数据源(OAF篇)
    查看>>
    oracle Extract 函数
    查看>>
    uni-app开发环境自动部署的一个误区(App running at...)
    查看>>
    Oracle GoldenGate Director安装和配置(无图)
    查看>>
    Oracle Goldengate在HP平台裸设备文件系统OGG-01028处理
    查看>>
    oracle instr函数详解
    查看>>
    Oracle Java所有版本的下载链接
    查看>>
    Oracle JDBC url的几种方式
    查看>>
    Oracle JDBC 连接卡死后 Connection Reset
    查看>>
    Oracle JDK vs OpenJDK
    查看>>
    ORACLE MERGE INTO (2)
    查看>>
    oracle ogg 单实例双向复制搭建(oracle-oracle)--Oracle GoldenGate
    查看>>
    Oracle ora-12514报错解决方法
    查看>>
    oracle ORA-14402 OGG-01296
    查看>>
    oracle package包头和package body包体例子
    查看>>
    oracle partition by list,深入解析partition-list 分区
    查看>>
    Oracle PL/SQL Dev工具(破解版)被植入勒索病毒的安全预警及自查通告
    查看>>