当前位置:网站首页>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
边栏推荐
- Sql1 [geek challenge 2019]
- Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
- Unfortunately, I broke the leader's confidential documents and spit blood to share the code skills of backup files
- Go language self-study series | golang nested structure
- About CIN, scanf and getline, getchar, CIN Mixed use of getline
- Number of islands
- NPM installation yarn
- Kettle experiment conversion case
- Go language self-study series | initialization of golang structure
- I don't understand time, timestamp and time zone. Look at this article
猜你喜欢

Go language learning notes - array | go language from scratch

Kettle experiment

NLLLoss+log_ SoftMax=CE_ Loss
![[geek challenge 2019] havefun1](/img/8b/b15bf31771d54db25f24d630e64093.png)
[geek challenge 2019] havefun1

MySQL of database -- overview and installation
![3、 6 [Verilog HDL] gate level modeling of basic knowledge](/img/36/46f2413ecb12f81c003848c93f6bc9.jpg)
3、 6 [Verilog HDL] gate level modeling of basic knowledge

LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands

653. Sum of two IV - input BST

Canary publishing using ingress

Non duplicate data values of two MySQL query tables
随机推荐
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
MySQL of database -- overview and installation
Notes on xctf questions
Machine learning (VI) -- Bayesian classifier
Using sqlmap injection to obtain the account and password of the website administrator
Single sign on SSO
MySQL - Chapter 1 (data types in MySQL)
node安装
Kettle experiment (III)
[geek challenge 2019] havefun1
Two ways for flutter providers to share data
How does kubernetes use harbor to pull private images
LeetCode396. Rotate array
Kettle experiment
ASUS laptop can't read USB and surf the Internet after reinstalling the system
成功的DevOps Leader 应该清楚的3个挑战
Number of islands
Distributed message oriented middleware framework selection - Digital Architecture Design (7)
nn. Explanation of module class
On array replication