微信小程序开发交流qq群   173683895

   承接微信小程序开发。扫码加微信。

动画效果

源码

 <!-- 动画 --><block wx:if="{{donghua}}"><view class='donghua'><image bindtap='hua' style='left:{{left1}}px' animation="{{animationData1}}" class='love' src='../../img/1.jpg'></image><image bindtap='hua' style='left:{{left2}}px' animation="{{animationData2}}" class='love' src='../../img/1.jpg'></image><image bindtap='hua' style='left:{{left3}}px' animation="{{animationData3}}" class='love' src='../../img/1.jpg'></image><image bindtap='hua' style='left:{{left4}}px' animation="{{animationData4}}" class='love' src='../../img/1.jpg'></image><image bindtap='hua' style='left:{{left5}}px' animation="{{animationData5}}" class='love' src='../../img/1.jpg'></image><image bindtap='hua' style='left:{{left6}}px' animation="{{animationData6}}" class='love' src='../../img/1.jpg'></image></view></block>

wxss


image{margin-top: -50rpx;width: 40rpx;height: 40rpx;margin-left: 5%;position: absolute;}

js

var animation = wx.createAnimation({})
var i = 1;
Page({data: {donghua: true,left1: Math.floor(Math.random() * 305 + 1),left2: Math.floor(Math.random() * 305 + 1),left3: Math.floor(Math.random() * 305 + 1),left4: Math.floor(Math.random() * 305 + 1),left5: Math.floor(Math.random() * 305 + 1),left6: Math.floor(Math.random() * 305 + 1),},onShow: function() {this.donghua()},donghua: function() {var that = this;setTimeout(function() {animation.translateY(604).step({duration: 2000})that.setData({["animationData" + i]: animation.export()})i++;}.bind(that), 200)if (i < 7) {setTimeout(function() {that.donghua()}.bind(that), 200)} else {i = 0; animation.translateY(-604).step({duration: 10})setTimeout(function() {for (var y = 0; y < 7; y++) {that.setData({["animationData" + y]: animation.export()})that.setData({["animationData" + y + '.actions[0].animates[0].args[0]']: 0})}}.bind(that), 2200)setTimeout(function() {that.donghua()}.bind(that), 2200)}}
})

微信小程序动画无限循环 掉花相关推荐

  1. [微信小程序]动画,从顶部掉花的效果(完整代码附效果图)

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. 正文: image{ width: 100rpx;height: 100rpx;position: absol ...

  2. 微信小程序动画(七):让页面动起来

    本文默认读者已具备小程序基本动画api,如不了解可先阅读相关的详细介绍文章: 微信小程序动画(一):样式 微信小程序动画(二):旋转 微信小程序动画(三):缩放 微信小程序动画(四):平移 微信小程序 ...

  3. 微信小程序动画渐入以及动态存值setdata问题

    微信小程序动画渐入以及动态存值setdata问题 想要在微信小程序中制作多个元素逐一渐入的效果,效果类似下图: 首先参考微信开发文档API动画部分的内容 开发文档API–动画Animation 创建动 ...

  4. 微信小程序--动画animation

    微信小程序--动画animation 一. 获取需要实现动画效果的元素 1. 微信小程序获取元素节点: 2. 合适的生命周期调用 二.动画 1. 创建动画 2. 监听动画 3. 动画循环播放 一. 获 ...

  5. 微信小程序动画之圆形进度条

    微信小程序动画之圆形进度条 上图: 代码: js: //获取应用实例 var app = getApp()var interval; var varName; var ctx = wx.createC ...

  6. 微信小程序关于for循环之后setData

    微信小程序关于for循环之后setData Page({/*** 页面的初始数据*/data: {types: [],select: '',goods:[]},onLoad: function (op ...

  7. 微信小程序动画执行一次问题

    微信小程序动画执行一次解决方法 简单总结一下微信动画的实现及执行步骤(更新data使用的方式和vue一样直接this.data=""). const anim = wx.creat ...

  8. 微信小程序动画效果,小程序animation动画

    微信小程序动画效果 最近一直在做小程序开发,在官方文档中无意间看到过渡动画效果,我就有点小激动,用每一个开发框架的时候我都最先研究动画和过渡 闲来无事写了一个小demo <!--wxml代码-- ...

  9. 微信小程序如何双重循环

    微信小程序解决双重循环 准备知识 wx:for : 使用数组中各项的数据重复渲染该组件 当前项的下标变量名默认为 index,当前项的变量名默认为 item 可使用 wx:for-item 指定当前元 ...

最新文章

  1. android+图标闪烁动画,如何在android中闪烁通知图标? [DONE]
  2. 《初级前端开发人员经常容易忽视几个细节问题汇总》
  3. js_xpath_搞不定的东西
  4. [ExtJS5学习笔记]第十一节 Extjs5MVVM模式下系统登录实例
  5. 【 FPGA 】抢占式优先级译码器电路
  6. Sql 存储过程加游标结合的使用
  7. 友元函数 友元类 友元成员函数
  8. 关于GTID模式下备份时 --set-gtid-purged=OFF 参数的实验【转】
  9. rust 官服指令_【RUST】每个RUST玩家都需要的十个指令
  10. SQL 合并列值和拆分列值
  11. java生成mib文件_SNMP之MIB文件创建
  12. c语言上机作业数组,2015二级c语言上机题库
  13. oracle excel更新,excel表格的数据如何更新-如何将excel表格更新oracle数据库中数据...
  14. 关于Postman导入json文件报:failed to import data format not recognized异常的处理
  15. js:腾讯云播放器无法自动播放的问题
  16. AR涂涂乐⭐七、(end)取消“识别成功”提示面片、加入太阳系及其交互功能、退出按钮设置
  17. 卷积神经网络超详细介绍
  18. 百万点赞怎么来?Python批量制作抖音的卡点视频原来这么简单!
  19. JavaScript 中 var 、let、const区别
  20. Scapy用法官方文档

热门文章

  1. yapi-docker
  2. ---Intel SSD 750 under Linux
  3. 使用read write 读写socket
  4. jQuery UI 之 LigerUI 快速入门
  5. 零基础学汇编 --小甲鱼
  6. 学习ExtJS4 常用控件
  7. linux 安装输入法
  8. IIS6 MVC3 配置
  9. 微软鲍尔默回应被苹果超越:将开发更好产品
  10. android资料整理