Skip to content

Commit e8a19e5

Browse files
committed
fix typos and slightly change canvas tutorial wording
1 parent 35b3ccb commit e8a19e5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

js/lesson6/tutorial.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var context = canvas.getContext('2d');
3434

3535
### Controls
3636

37-
Depending on if we are filling up a shape, or just drawing the outline, we can use `fillStyle` or `strokeStyle`to set the color of the element.
37+
Depending on if we are filling up a shape, or just drawing the outline, we can use `context.fillStyle` or `context.strokeStyle`to set the color of the element.
3838

3939
```js
4040
context.fillStyle = 'yellow';
@@ -44,7 +44,7 @@ Depending on if we are filling up a shape, or just drawing the outline, we can u
4444
To set the line width:
4545

4646
```js
47-
context.lineWidth = '3';
47+
context.lineWidth = 3;
4848
```
4949

5050
#### Drawing
@@ -68,7 +68,7 @@ Now let's add another rectangle, but this time only its outline.
6868
context.strokeRect(300, 100, 50, 100);
6969
```
7070

71-
**Bonus** Add a new rectangle outline with dimensions **120x150** at the bottom right of the screen. The **line width** of the rectangle should be 1.
71+
**Bonus** Add a new rectangle outline with dimensions **120x150** at the bottom right of the canvas. The **line width** of the rectangle should be 1.
7272

7373
### Reseting canvas
7474

@@ -91,7 +91,7 @@ context.moveTo(0,300);
9191
context.lineTo(400,500);
9292
```
9393

94-
This won't do anything until we call the `stroke()`, which deals with the painting.
94+
This won't do anything until we call `context.stroke()`, which deals with the painting.
9595

9696
You can also draw an join multiple paths together. Try this out by creating a rectangle with corners at (0, 0), (0, 200), (200, 300) and (200, 0).
9797

@@ -112,7 +112,7 @@ context.stroke();
112112

113113
## Drawing circles
114114

115-
To draw circles, you can use the `arc` method. `arc(x, y, radius, staging_angle, endingAngle, counterClockwise)`
115+
To draw circles, you can use the `arc` method. `arc(x, y, radius, startAngle, endAngle, counterClockwise)`. Angles are expressed in radians. In radians 2π equates to 360°.
116116

117117
```javascript
118118
context.beginPath();
@@ -122,7 +122,7 @@ context.lineWidth = 4;
122122
context.stroke();
123123
```
124124

125-
To fill in the circle, or any other joined elements, we use the `fill()` method after closing the path.
125+
To fill in the circle, or any other joined elements, we use the `context.fill()` method after closing the path.
126126

127127
**Exercise** Create another circle and fill it with the color blue.
128128

@@ -132,7 +132,7 @@ In canvas, we can also use transformations on the current matrix.
132132

133133
### `rotate()`
134134

135-
First add the rotate method at the bottom of the `draw()` method.
135+
First add the rotate method at the bottom of the `draw()` function.
136136

137137
```javascript
138138
context.rotate(10*Math.PI/180);
@@ -152,15 +152,15 @@ context.restore()
152152

153153
### `translate()`
154154

155-
Translate moves the current position. If we are at 10, 10 and we `translate(20, 15)`, then our new position is 30, 45.
155+
Translate moves the current position. If we are at 10, 10 and we `context.translate(20, 15)`, then our new position is 30, 45.
156156

157157
```javascript
158158
context.translate(45, 45);
159159
```
160160

161161
### `scale()`
162162

163-
And finally, `scale(scaleWidth, scalewHeight)`. Scale changes the dimensions of the rendered items.
163+
And finally, `context.scale(scaleWidth, scaleHeight)`. Scale changes the dimensions of the rendered items.
164164

165165

166166
```javascript
@@ -182,7 +182,7 @@ We have already created the functions to draw the individual parts, so you shoul
182182
> Use pen and paper to think about the position of each element. You already know that the top left is 0,0 and the bottom right 400, 500. Use a grid if you are finding it hard.
183183
184184

185-
> Don't forget `beginPath()` and `stroke()` before and after drawing elements.
185+
> Don't forget `context.beginPath()` and `context.stroke()` before and after drawing elements.
186186
187187
Here is our version of [Hangman in Canvas](../../examples/hangman-canvas/index.html).
188188

0 commit comments

Comments
 (0)