-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4be7e17
commit cd353bb
Showing
2 changed files
with
35 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,32 @@ | ||
import 'package:badgemagic/badge_animation/animation_abstract.dart'; | ||
|
||
class LeftAnimation 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 how much of the new grid is currently visible in the grid | ||
int scrollOffset = animationIndex % (newWidth + badgeWidth); | ||
|
||
// Get the corresponding column in the new grid based on the scroll position | ||
int sourceCol = j + scrollOffset - badgeWidth; | ||
|
||
// If sourceCol is negative, display blank space (off-screen part of the grid) | ||
if (sourceCol >= 0 && sourceCol < newWidth) { | ||
// Ensure flashLEDOn and validMarquee effects are applied | ||
grid[i][j] = flashLEDOn && newGrid[i % newHeight][sourceCol] == 1; | ||
} else { | ||
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