-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added the scroll up animation. (#1020)
- Loading branch information
1 parent
cdebe46
commit 7b087ca
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:badgemagic/badge_animation/animation_abstract.dart'; | ||
|
||
class UpAnimation extends BadgeAnimation { | ||
@override | ||
void processAnimation(int badgeHeight, int badgeWidth, int animationIndex, | ||
List<List<bool>> processGrid, List<List<bool>> canvas) { | ||
int newWidth = processGrid[0].length; | ||
int newHeight = processGrid.length; | ||
for (int i = 0; i < badgeHeight; i++) { | ||
for (int j = 0; j < badgeWidth; j++) { | ||
if (j < badgeWidth && i < badgeHeight) { | ||
int newGridRow = (i + animationIndex + newHeight) % newHeight; | ||
|
||
bool upCondition = (i >= 0 && | ||
i < newHeight && | ||
j >= 0 && | ||
j < newWidth && | ||
processGrid[newGridRow][j]); | ||
|
||
canvas[i][j] = upCondition; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters