当前位置:网站首页>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
边栏推荐
- Thread scheduling (priority)
- I don't understand time, timestamp and time zone. Look at this article
- Notes on xctf questions
- Go language self-study series | initialization of golang structure
- Go language learning notes - slice, map | go language from scratch
- Applet in wechat and app get current ()
- LeetCode 1611. The minimum number of operations to make an integer 0
- Open services in the bottom bar of idea
- 501. 二叉搜索树中的众数
- node安装
猜你喜欢
A must see wechat applet development guide 1 - basic knowledge
Using JS to realize a thousandth bit
Cross domain configuration error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
112. 路径总和
数据清洗 ETL 工具Kettle的安装
Chapter VIII project stakeholder management of information system project manager summary
SAP 101K 411K 库存变化
小程序报错:Cannot read property 'currentTarget' of undefined
Summary of wrong questions 1
[58] length of the last word [leetcode]
随机推荐
The most concerned occupations after 00: civil servants ranked second. What was the first?
About CIN, scanf and getline, getchar, CIN Mixed use of getline
Group Backpack
501. Mode in binary search tree
To remember the composition ~ the pre order traversal of binary tree
Little girl walking
Number theory to find the sum of factors of a ^ B (A and B are 1e12 levels)
108. 将有序数组转换为二叉搜索树
108. Convert an ordered array into a binary search tree
Cross domain configuration error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
[Luke V0] verification environment 2 - Verification Environment components
LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands
MySQL小练习(仅适合初学者,非初学者勿进)
Buuctf [actf2020 freshman competition] include1
Brush classic topics
First principle mind map
Simple understanding of arguments in JS
Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
Applet error: cannot read property'currenttarget'of undefined
Redis Desktop Manager for Mac