-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updated the code and created the right animation.
- Loading branch information
1 parent
297dba7
commit ac4f9a6
Showing
3 changed files
with
46 additions
and
12 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,32 @@ | ||
import 'package:badgemagic/badge_animation/animation_abstract.dart'; | ||
|
||
class RightAnimation extends BadgeAnimation { | ||
@override | ||
void animation( | ||
List<List<bool>> grid, | ||
List<List<int>> newGrid, | ||
int animationIndex, | ||
bool validMarquee, | ||
bool flashLEDOn, | ||
int currentcountFrame, | ||
int i, | ||
int j, | ||
int newHeight, | ||
int newWidth, | ||
int badgeHeight, | ||
int badgeWidth) { | ||
// Calculate the scroll offset to move from left to right | ||
int scrollOffset = animationIndex % (newWidth + badgeWidth); | ||
|
||
// Get the corresponding column in the new grid based on the reversed scroll position | ||
int sourceCol = newWidth - scrollOffset + j; | ||
|
||
// If sourceCol is within bounds of the new grid, display it, else blank space | ||
if (sourceCol >= 0 && sourceCol < newWidth) { | ||
grid[i][j] = | ||
validMarquee || flashLEDOn && newGrid[i % newHeight][sourceCol] == 1; | ||
} else { | ||
validMarquee ? grid[i][j] = true : grid[i][j] = false; | ||
} | ||
} | ||
} |
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
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