The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 2


Code Explanation


ctx.fillStyle = "#009966"; Set color.


switch(n) { Start switch using the number of dots.


case 1: If it is 1


draw1(); Call the draw1 function


break; Break out of the switch


Case 2: If it is 2


draw2(); Call the draw2 function


break; Break out of the switch


Case 3: If it is 3


draw2(); First call draw2 and then


draw1(); Call draw1


break; Break out of the switch


Case 4: If it is 4


draw4(); Call the draw4 function


break; Break out of the switch


Case 5: If it is 5


draw4(); Call the draw4 function and then


draw1(); Call the draw1 function


break; Break out of the switch


Case 6: If it is 6


draw4(); Call the draw4 function and then

Free download pdf