File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ function createSnowflake() {
3131 // Choose a random size between 10 and 30 pixels for the snowflake
3232 let size = random ( 10 , 30 ) ;
3333
34+ // Pick a random opacity for the snowflake
35+ let opacity = Math . random ( ) ;
36+
3437 // Returns an object with snowflake properties
3538 return {
3639 char : char ,
@@ -39,6 +42,7 @@ function createSnowflake() {
3942 x : x ,
4043 y : y ,
4144 size : size ,
45+ number : opacity
4246 } ;
4347}
4448
@@ -73,9 +77,10 @@ function draw() {
7377 // Get the current snowflake
7478 let flake = flakes [ i ] ;
7579
76- // Setting the color and size of the pen to draw a snowflake
80+ // Setting the color and size and opacity of the pen to draw a snowflake
7781 ctx . fillStyle = flake . color ;
7882 ctx . font = flake . size + "px Arial" ;
83+ ctx . opacity = flake . opacity ;
7984
8085 // Draw a snowflake using the fillText method
8186 ctx . fillText ( flake . char , flake . x , flake . y ) ;
You can’t perform that action at this time.
0 commit comments