finished ch 9
This commit is contained in:
		
							
								
								
									
										10
									
								
								10/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								10/index.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| <!DOCTYPE html> | ||||
| <html> | ||||
|   <head> | ||||
|     <title>Tennjs</title> | ||||
|   </head> | ||||
|   <body> | ||||
|     <canvas id="canvas" width="300" height="300"></canvas> | ||||
|     <script src="script.js"></script> | ||||
|   </body> | ||||
| </html> | ||||
							
								
								
									
										12
									
								
								10/script.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								10/script.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| let canvas = document.querySelector("#canvas"); | ||||
| let ctx = canvas.getContext("2d"); | ||||
| let width = canvas.width; | ||||
| let height = canvas.height; | ||||
| const BALL_SIZE = 5; | ||||
| let ballPosition = {x: 20, y: 30}; | ||||
| function draw() { | ||||
| ctx.fillStyle = "black"; ctx.fillRect(0, 0, width, height); | ||||
|      ctx.fillStyle = "white"; | ||||
|      ctx.fillRect(ballPosition.x, ballPosition.y, BALL_SIZE, BALL_SIZE); | ||||
|    } | ||||
| draw(); | ||||
		Reference in New Issue
	
	Block a user