File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const canvas = document . getElementById ( 'canvas' ) ;
2+ const ctx = canvas . getContext ( '2d' ) ;
3+
4+ ctx . fillStyle = 'blue' ;
5+
6+ function animate ( ) {
7+ ctx . clearRect ( 0 , 0 , 480 , 320 ) ;
8+
9+ ctx . fillRect ( 10 , 10 , 100 , 100 ) ;
10+
11+ requestAnimationFrame ( animate ) ;
12+ }
13+
14+ animate ( ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Breakout!</ title >
6+ < link rel ="stylesheet " href ="style.css " type ="text/css ">
7+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8+ < style >
9+ * {
10+ padding : 0 ;
11+ margin : 0 ;
12+ }
13+ canvas {
14+ background : # eeeeee ;
15+ display : block;
16+ margin : 10px auto;
17+ }
18+ </ style >
19+ </ head >
20+ < body >
21+ < canvas id ="canvas " width ="480 " height ="320 " style ="border:1px solid black; "> </ canvas >
22+ < script src ="game.js "> </ script >
23+ </ body >
24+ </ html >
You can’t perform that action at this time.
0 commit comments