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

    你可能感兴趣的文章
    OfficeWeb365 Indexs 任意文件读取漏洞复现
    查看>>
    OfficeWeb365 Readfile 任意文件读取漏洞复现
    查看>>
    OfficeWeb365 SaveDraw 文件上传漏洞复现
    查看>>
    office中的所有content type
    查看>>
    office之Excel 你会用 Ctrl + E 吗?
    查看>>
    Office办公软件里的“开发工具”选项卡-ChatGPT4o作答
    查看>>
    Office开发工具选项卡中的控件-ChatGPT4o作答
    查看>>
    Offline Installation the .NET Framework 3.5 on Windows 8
    查看>>
    OGC服务标准(地图资料篇.3)
    查看>>
    OGG初始化之使用数据库实用程序加载数据
    查看>>
    ogg参数解析
    查看>>
    ognl详解
    查看>>
    Ogre 插件系统
    查看>>
    Oil Deposits
    查看>>
    oj2894(贝尔曼福特模板)
    查看>>
    OJ4TH|Let's play a game
    查看>>
    OJ中处理超大数据的方法
    查看>>
    OJ中常见的一种presentation error解决方法
    查看>>
    OK335xS UART device registe hacking
    查看>>
    ok6410内存初始化
    查看>>