博客
关于我
微信小程序动画效果方法封装
阅读量: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改变数组key值的方法
    查看>>
    php教程之php空白页的原因及解决方法
    查看>>
    PHP数据库操作
    查看>>
    PHP数据文件过大,导致PHP加速器eaccelerator在PHP5.2版本下崩溃
    查看>>
    RabbitMQ - 死信、TTL原理、延迟队列安装和配置
    查看>>
    PHP数据访问的多重查询(租房子查询)
    查看>>
    RabbitMQ - 如保证消息的可靠性?(消息确认、消息持久化、失败重试机制)
    查看>>
    RabbitMQ - 基于 SpringAMQP 带你实现五种消息队列模型
    查看>>
    php数组函数分析--array_column
    查看>>
    php数组去重复数据的小例子
    查看>>
    php数组实现:哈希 +双向链表
    查看>>
    PHP数组排序函数array_multisort()函数详解(二)
    查看>>
    php数组的几个函数和超全局变量
    查看>>
    PHP文件上传详解
    查看>>
    PHP文件锁
    查看>>
    php文本框输入制定文本,php – 当用户没有向文本框输入任何内容时...
    查看>>
    PHP时间戳和日期相互转换操作总结
    查看>>
    php时间戳知识点,php 时间戳函数总结与示例
    查看>>
    php更新数据库失败,php – 无法更新MySQL数据库
    查看>>
    php机器人聊天对话框,基于AIML的PHP聊天机器人
    查看>>