MoveAlongPathEffect (#1172)

* MoveAlongPathEffect separated from MoveEffect

* rename _lastPosition -> _lastOffset

* Added absolute= flag in MoveAlongPathEffect

* added test for absolute path

* add oriented= flag

* added test

* changelog

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
This commit is contained in:
Pasha Stetsenko
2021-12-07 11:45:53 -08:00
committed by GitHub
parent 3ae134aee5
commit 96991122f4
7 changed files with 232 additions and 104 deletions

View File

@ -89,14 +89,16 @@ class MoveEffectExample extends FlameGame {
for (var i = 0; i < 40; i++) {
add(
CircleComponent(radius: 5)
..position = Vector2(0, -1000)
..add(
MoveEffect.along(
MoveAlongPathEffect(
path1,
EffectController(
duration: 10,
startDelay: i * 0.2,
infinite: true,
),
absolute: true,
),
),
);
@ -108,13 +110,14 @@ class MoveEffectExample extends FlameGame {
RectangleComponent.square(size: 10)
..paint = (Paint()..color = Colors.tealAccent)
..add(
MoveEffect.along(
MoveAlongPathEffect(
path2,
EffectController(
duration: 6,
startDelay: i * 0.3,
infinite: true,
),
oriented: true,
),
),
);