@@ -6,25 +6,18 @@ class SnowFlakeAnimation extends BadgeAnimation {
6
6
List <List <bool >> processGrid, List <List <bool >> canvas) {
7
7
int newGridHeight = processGrid.length;
8
8
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;
16
9
17
- // Calculate the starting column for the current frame in newGrid
18
- int startCol = currentcountFrame * badgeWidth;
10
+ int framesCount = (newGridWidth / badgeWidth).ceil ();
19
11
20
- bool isNewGridCell = i < newGridHeight && (startCol + j) < newGridWidth ;
12
+ int currentFrame = animationIndex % framesCount ;
21
13
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;
25
15
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 ;
27
20
}
28
21
}
29
22
}
30
- }
23
+ }
0 commit comments