Skip to content

Commit dbd1504

Browse files
authored
Formatting code snippets and bullet lists
Another readme formatted, another collection of errors slain. \m/
1 parent 2d5852d commit dbd1504

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

exercises/19 - Webcam Fun/README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -95,47 +95,47 @@ The last function we'll want to create is one that will bring functionality to t
9595
})
9696
.catch(err => {
9797
console.error(`OH NO!!!`, err);
98-
});
99-
}
98+
})
99+
};
100100
```
101101

102102
2. Declare a `const` variable `paintToCanvas` and define it as an arrow function.
103103

104104
```JavaScript
105-
const paintToCanvas = () => { /* ... */}
105+
const paintToCanvas = () => { /* ... */};
106106
```
107107

108-
- In the body of this function, declare two `const` variables and define them
109-
as the `video` element's width and height, and update the `canvas` width and height
110-
to reflect those values.
108+
- In the body of this function, declare two `const` variables and define them
109+
as the `video` element's width and height, and update the `canvas` width and height
110+
to reflect those values.
111111

112-
```JavaScript
112+
```JavaScript
113113
const paintToCanavas = () => {
114114
const width = video.videoWidth;
115115
const height = video.videoHeight;
116116
canvas.width = width;
117117
canvas.height = height;
118118

119-
/* More to do... */
120-
}
121-
```
122-
123-
- Still in the body of the function, return the _interval ID_ of a `setInterval()`
124-
function call, and within the body of that function call, draw the current `video`
125-
element on to the `canvas.
126-
127-
```JavaScript
128-
let paintToCanavas = () => {
129-
const width = video.videoWidth;
130-
const height = video.videoHeight;
131-
canvas.width = width;
132-
canvas.height = height;
133-
134-
return setInterval(() => {
135-
ctx.drawImage(video, 0, 0, width, height);
136-
}, 16);
137-
}
138-
```
119+
/* More to do... */
120+
};
121+
```
122+
123+
- Still in the body of the function, return the _interval ID_ of a `setInterval()`
124+
function call, and within the body of that function call, draw the current `video`
125+
element on to the `canvas.`
126+
127+
```JavaScript
128+
let paintToCanavas = () => {
129+
const width = video.videoWidth;
130+
const height = video.videoHeight;
131+
canvas.width = width;
132+
canvas.height = height;
133+
134+
return setInterval(() => {
135+
ctx.drawImage(video, 0, 0, width, height);
136+
}, 16);
137+
};
138+
```
139139

140140
3. Declare a `const` variable `takePhoto` and define it as an arrow function that will
141141
play the `audio` element on the HTML page, create a link which targets a _data URI_
@@ -154,36 +154,36 @@ The last function we'll want to create is one that will bring functionality to t
154154
link.setAttribute('download', 'handsome');
155155
link.innerHTML = `<img src="${data}" alt="Handsome Man" />`;
156156
strip.insertBefore(link, strip.firsChild);
157-
}
157+
};
158158
```
159159

160160
4. Declare a `const` variable `greenScreen` and define it as an _arrow function_ that will
161161
accept an argument `pixels`.
162162

163163
```JavaScript
164-
const greenScreen = (pixels) => { /*...*/ }
164+
const greenScreen = (pixels) => { /*...*/ };
165165
```
166166

167-
- In the function body, declare a `const` variables `levels` and define it as an empty
168-
object. Iterate through a _NodeList_ of all `input` elements within the div with class
169-
`rgb` and set a key in the `levels` object as a given input's `name` property, and
170-
set the value to be the given input's `value`.
167+
- In the function body, declare a `const` variables `levels` and define it as an empty
168+
object. Iterate through a _NodeList_ of all `input` elements within the div with class
169+
`rgb` and set a key in the `levels` object as a given input's `name` property, and
170+
set the value to be the given input's `value`.
171171

172-
```JavaScript
172+
```JavaScript
173173
/* In function body */
174174

175175
const levels = {};
176176

177177
document.querySelectorAll('.rgb input').forEach((input) => {
178178
levels[input.name] = input.value;
179179
});
180-
```
180+
```
181181

182-
- Update the values of the pixels in the image so that we remove all RGB
183-
values that are within the range defined by the user, and return the given
184-
argument.
182+
- Update the values of the pixels in the image so that we remove all RGB
183+
values that are within the range defined by the user, and return the given
184+
argument.
185185

186-
```JavaScript
186+
```JavaScript
187187
/* In function body */
188188
for (i = 0; i < pixels.data.length; i += 4) {
189189
red = pixels.data[i + 0];
@@ -201,8 +201,8 @@ The last function we'll want to create is one that will bring functionality to t
201201
pixels.data[i + 3] = 0;
202202
}
203203
}
204-
return pixels
205-
```
204+
return pixels;
205+
```
206206

207207
5. Update the `getVideo` function so that the setInterval method within the function body
208208
creates a variable defined as the _underlying pixel data_, passes that variable into the

0 commit comments

Comments
 (0)