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

    你可能感兴趣的文章
    php增删改查封装方法
    查看>>
    springboot之jar包Linux后台启动部署及滚动日志查看且日志输出至文件保存(超级详细)
    查看>>
    php多条件筛选功能的实现
    查看>>
    php多线程
    查看>>
    PHP大数组循环-避免产生Notice或者是Warning
    查看>>
    PHP大数组过滤元素、修改元素性能分析
    查看>>
    PHP大文件切片下载代码
    查看>>
    PHP如何下载远程文件到指定目录
    查看>>
    php如何优化压缩的图片
    查看>>
    php如何做表格,新手怎么制作表格
    查看>>
    RabbitMQ高级特性
    查看>>
    php如何定义的数位置,php如何实现不借助IDE快速定位行数或者方法定义的文件和位置...
    查看>>
    RabbitMQ集群 - 普通集群搭建、宕机情况
    查看>>
    php如何正确的获得文件的后缀名
    查看>>
    PHP如何生成唯一的数字ID
    查看>>
    PHP如何获取当前页面的最后修改时间
    查看>>
    PHP如何读取json数据
    查看>>
    PHP字符串
    查看>>