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

    你可能感兴趣的文章
    PS —— 制作喷漆人像
    查看>>
    PS —— 制作证件照
    查看>>
    PS —— 精修图像
    查看>>
    PS 图像调整算法——色调分离
    查看>>
    ps 图层混合模式
    查看>>
    ps2025下载安装教程(附安装包)ps2025超详细安装教程
    查看>>
    PSGSuite 项目推荐
    查看>>
    PSR PHP业界规范
    查看>>
    psv黑商店pkgj最新版下载_黑科技p图app下载-黑科技p图最新版下载v1.0.0
    查看>>
    ps命令详解
    查看>>
    PyTorch-Tutorials【pytorch官方教程中英文详解】- 1 Quickstart
    查看>>
    PS网页设计教程XVIII——在Photoshop中设计优雅的乡村酒店或餐厅的网页布局
    查看>>
    PS获取RGB和十六进制的颜色值
    查看>>
    PyTorch 的 10 条顶级知识点
    查看>>
    PS辅助工具Assistor PS
    查看>>
    pt-archiver 归档历史数据及参数详解
    查看>>
    pt-online-schema-change使用详解
    查看>>
    PyTorch 模型性能分析和优化 — 第 2 部分
    查看>>
    PTA L1-011 A-B
    查看>>
    pta l2-1紧急救援(Dijkstra)
    查看>>