
老孟导读:Flutter 动画系列文章分为三部分:基础原理和核心概念、系统动画组件、8篇自定义动画案例,共17篇。
动画核心概念
在开发App的过程中,自定义动画必不可少,Flutter 中想要自定义动画,首先要理解 Flutter 动画实现的基本原理及相关概念。
第1-4篇介绍了 Flutter 动画中最重要的三个概念以及三者之间的关系:
- AnimationController:动画控制器,控制动画的播放、停止等。继承自Animation< double >,是一个特殊的Animation对象,默认情况下它会线性的生成一个0.0到1.0的值,类型只能是 double 类型,不设置动画曲线的情况下,可以设置输出的最小值和最大值。
- Curve:动画曲线,作用和Android中的Interpolator(差值器)类似,负责控制动画变化的速率,通俗地讲就是使动画的效果能够以匀速、加速、减速、抛物线等各种速率变化。
- Tween:将 AnimationController 生成的 [0,1]值映射成其他属性的值,比如颜色、样式等。
第5篇讲解了动画序列 TweenSequence,其将多个 Tween 或者 Curve 关联到一个 AnimationController 中。
文章链接:
- 动画核心-AnimationController:http://laomengit.com/guide/animation/AnimationController.html
- 动画核心-Tween:http://laomengit.com/guide/animation/Tween.html
- 动画核心-Curve:http://laomengit.com/guide/animation/Curve.html
- 动画核心-总结:http://laomengit.com/guide/animation/AnimationSummary.html
- 动画序列 TweenSequence: http://laomengit.com/guide/animation/TweenSequence.html
系统动画组件
第6篇介绍了20多种系统动画组件的用法以及如何选取使用哪一种组件,乍一看20多种系统动画组件非常多,但其仅分为隐式动画组件 和 显式动画组件 两种,用法基本一样。文章地址:http://laomengit.com/guide/animation/AnimatedWidget.html
第7篇讲解 AnimatedList 列表增/删动画组件:http://laomengit.com/guide/animation/AnimatedList.html

第8篇讲解 Hero 共享动画组件:http://laomengit.com/guide/animation/Hero.html

第9篇讲解 Material motion 动画,Material motion 是 Flutter 1.17 大会上 Flutter 团队发布的新的 Animations 软件包,该软件包提供了实现新的 Material motion 规范的预构建动画:http://laomengit.com/guide/animation/TranslationAnimations.html


自定义动画
第10篇案例-自定义路由动画:http://laomengit.com/guide/animation/NavigatorAnimation.html

第11篇案例-“孔雀开屏”的动画效果:http://laomengit.com/guide/animation/Peacock.html

第12篇案例-自定义渐变进度条:http://laomengit.com/guide/animation/CircleProgress.html

第13篇案例-自绘玫瑰:http://laomengit.com/guide/animation/Rose.html

第14篇案例-仿掘金点赞:http://laomengit.com/guide/animation/JuejinLike.html

第15篇案例-酷炫的3D效果:http://laomengit.com/guide/animation/3DPerspective.html


第16篇案例-涟漪效果:http://laomengit.com/guide/animation/WaterRipple.html

第17篇案例-雷达扫描效果:http://laomengit.com/guide/animation/Radar.html

结尾
很多人都觉得 Flutter 动画比较难,不好入门,很多读者也反馈如何才能自定义动画?下面是我对学习 Flutter 动画的一些方法:
- 第一步:详细的阅读第1-5篇,也就是基础概念部分,当然对于初学者来说,阅读完后依然会迷茫,不理解,没关系,记住即可。
- 第二步:使用系统动画组件完成一些简单的动画效果,照猫画虎,不要觉得使用系统组件没有用处,当你写完20多个系统动画组件的用法的时候,你一定对动画的认知有极大的提升。
- 第三步:在回过头来,认认真真的阅读第1-5篇,相信我,你一定会有不一样的感觉。
- 第四步:动画系列文章中有8篇为自定义动画案例,建议先根据动画效果独自完成,如果没有思路再参考文章。
个人觉得只有通过多写才能理解的更加深刻,纸上得来终觉浅,绝知此事要躬行。
Flutter 动画系列已经全部完成,如果对你有所帮助,请不要吝惜你的赞 和 转发。
交流
老孟Flutter博客地址(330个控件用法):http://laomengit.com
欢迎加入Flutter交流群(微信:laomengit)、关注公众号【老孟Flutter】:
网友评论