当前位置:网站首页>Flutter 的加载动画这么玩更有趣
Flutter 的加载动画这么玩更有趣
2022-04-23 09:24:00 【岛上码农】
前言
我们使用 Stack
组件的时候,通常会使用 Positioned
组件来做子组件相对 Stack
的定位,Positioned
通过 top
,bottom
,height
三选二确定垂直方向的位置和尺寸,使用 left
,right
和 width
三选二确定水平方向的位置和尺寸。对应的,我们可以使用 AnimatedPositioned
组件来实现子组件在 Stack
中的移动、尺寸变化等其他效果。本篇我们用这个组件构建两个球追逐的动画效果,以便全面了解这个组件的使用。
效果解析
从动图可以看到,蓝色球和橙色球会一先一后沿着白色大圆的左、下、右、上顶点移动,同时在启动切换的时候会有弹入效果。具体实现的逻辑如下:
- 沿着大圆4个点移动效果,我们可以控制球的起始位置就可以搞定了。
- 弹入效果则可以使用
bounceIn
曲线实现。 - 对一先一后的追逐效果,可以设置一个有序的位置数组,一个球的位置是另一个球的下一个位置,可以通过使用不同的下标从位置数组取取位置实现。
- 重复动效的实现:重复动效使用
AnimatedPositioned
的onEnd
触发&
版权声明
本文为[岛上码农]所创,转载请带上原文链接,感谢
https://blog.csdn.net/shuijian00/article/details/124356123
边栏推荐
- MySQL of database -- basic common query commands
- Chapter VIII project stakeholder management of information system project manager summary
- [reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
- I don't understand time, timestamp and time zone. Look at this article
- Go language self-study series | golang structure as function parameter
- 成功的DevOps Leader 应该清楚的3个挑战
- Using JS to realize a thousandth bit
- 112. Path sum
- Leetcode-199 - right view of binary tree
- Principle of synchronized implementation
猜你喜欢
npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
Notes on xctf questions
Installation of data cleaning ETL tool kettle
Two methods of building Yum source warehouse locally
How to protect open source projects from supply chain attacks - Security Design (1)
501. Mode in binary search tree
Mini - exercice MySQL (seulement pour les débutants, pas pour les non - débutants)
kettle庖丁解牛第14篇之JSON输入
Applet error: cannot read property'currenttarget'of undefined
STM32 and FreeRTOS stack parsing
随机推荐
KVM installation and deployment
Kettle实验 (三)
To remember the composition ~ the pre order traversal of binary tree
About CIN, scanf and getline, getchar, CIN Mixed use of getline
Thread scheduling (priority)
MySQL - Chapter 1 (data type 2)
Failed to download esp32 program, prompting timeout
NPM installation yarn
Employee probation application (Luzhou Laojiao)
How to protect open source projects from supply chain attacks - Security Design (1)
653. Sum of two IV - input BST
kettle庖丁解牛第14篇之JSON输入
SAP 101K 411k inventory change
Kettle experiment conversion case
[Luke V0] verification environment 2 - Verification Environment components
Project upload part
Resource packaging dependency tree
DJ music management software pioneer DJ rekordbox
OpenCV中的图像处理 —— 轮廓入门+轮廓特征
tsdf +mvs