|
1 | 1 | //// { order: 5 } |
2 | 2 |
|
3 | | -// Create a HTML canvas which uses WebGL to render spinning |
4 | | -// confetti, let's walk through the code to understand how it works |
| 3 | +// This example create a HTML canvas which uses WebGL to |
| 4 | +// render spinning confetti using JavaScript. We're going |
| 5 | +// to walk through the code to understand how it works, and |
| 6 | +// see how TypeScript's tooling provides useful insight. |
5 | 7 |
|
6 | 8 | // This example builds off: example:working-with-the-dom |
7 | 9 |
|
@@ -37,8 +39,7 @@ const gl = canvas.getContext("webgl") |
37 | 39 | // array of vertices (numbers) |
38 | 40 |
|
39 | 41 | // You can see the large set of attributes at the top of the shader, |
40 | | -// these are passed in from |
41 | | -// |
| 42 | +// these are passed into the compiled shader further down the example. |
42 | 43 |
|
43 | 44 | // There's a great overview on how they work here: |
44 | 45 | // https://webglfundamentals.org/webgl/lessons/webgl-how-it-works.html |
@@ -117,9 +118,9 @@ gl.compileShader(vertexShader) |
117 | 118 | // shader is another small program that runs through every |
118 | 119 | // pixel in the canvas and set its color. |
119 | 120 |
|
120 | | -// In this case, if you play around with the numers you can see how |
| 121 | +// In this case, if you play around with the numbers you can see how |
121 | 122 | // this affects the lighting in the scene, as well as the border |
122 | | -// radius on the confetti |
| 123 | +// radius on the confetti: |
123 | 124 |
|
124 | 125 | const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER) |
125 | 126 | gl.shaderSource( |
|
0 commit comments