Skip to content

Commit 7fdc94e

Browse files
fix: Behaviour change in the Snowflake animation
1 parent afbe3b1 commit 7fdc94e

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

lib/badge_animation/ani_snowflake.dart

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,18 @@ class SnowFlakeAnimation extends BadgeAnimation {
66
List<List<bool>> processGrid, List<List<bool>> canvas) {
77
int newGridHeight = processGrid.length;
88
int newGridWidth = processGrid[0].length;
9-
for (int i = 0; i < badgeHeight; i++) {
10-
for (int j = 0; j < badgeWidth; j++) {
11-
// Calculate the total number of frames that fit the badge width
12-
int framesCount = (newGridWidth / badgeWidth).ceil();
13-
14-
// Determine the current frame based on the animation value
15-
int currentcountFrame = animationIndex ~/ badgeWidth % framesCount;
169

17-
// Calculate the starting column for the current frame in newGrid
18-
int startCol = currentcountFrame * badgeWidth;
10+
int framesCount = (newGridWidth / badgeWidth).ceil();
1911

20-
bool isNewGridCell = i < newGridHeight && (startCol + j) < newGridWidth;
12+
int currentFrame = animationIndex % framesCount;
2113

22-
// Update the grid based on the current frame's data
23-
bool snowflakeCondition =
24-
(isNewGridCell && processGrid[i][startCol + j]);
14+
int startCol = currentFrame * badgeWidth;
2515

26-
canvas[i][j] = snowflakeCondition;
16+
for (int i = 0; i < badgeHeight; i++) {
17+
for (int j = 0; j < badgeWidth; j++) {
18+
bool isInGrid = i < newGridHeight && (startCol + j) < newGridWidth;
19+
canvas[i][j] = isInGrid ? processGrid[i][startCol + j] : false;
2720
}
2821
}
2922
}
30-
}
23+
}

0 commit comments

Comments
 (0)