动画路径
一个Flutter包,用于在给定路径上创建修剪路径动画。
特点
- 起始点插值
- 终点插值
- 偏移量插值
- 支持非连续路径
展示
用法
AnimatedPath小部件用于为给定的animation动画化path。
AnimatedPath(
animation: animationController.view,
path: Path()
..moveTo(100, 100)
..relativeLineTo(400, 0)
..relativeLineTo(0, 400)
..relativeLineTo(-400, 0)
..relativeLineTo(0, -400),
paint: paint,
start: Tween(begin: 0.0, end: 0.7),
end: Tween(begin: 0.0, end: 1.0),
offset: Tween(begin: 0.0, end: 0.3),
)
- 为
path的start、end或offset提供初始值和最终值。
例如:
Tween(begin: 0.0, end: 1.0)
这将使path的start点位于(0.0 * pathLength)(初始状态),并在animation完成时位于(1.0 * pathLength)。对于介于0和1(含)之间的值,将只可见path。但是,可以提供< 0或> 1的值以获得不同的动画同步效果。
同样,对于end和offset。
-
end的值应根据提供的插值在任何时候都大于start,否则path将不可见。 -
offset值会在path的start和end值中都加上给定的animation值。 -
对于恒定值,请使用
ConstantTween。 -
适用于连续和非连续路径。
贡献
1. Fork it (<https://github.com/himanshugarg08/animated_path/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request

