docs(guide): canvas paths guide edits for clarity (#30729)
* "create use paths" --> "create and use paths" * Use ES6 syntax in code example (`var` --> `const`/`let`)
This commit is contained in:
@ -5,7 +5,7 @@ title: Paths
|
|||||||
|
|
||||||
Paths are the building block of drawing in Canvas. A path is just a shape. Then, the shape can be drawn on by either stroking it or filling it.
|
Paths are the building block of drawing in Canvas. A path is just a shape. Then, the shape can be drawn on by either stroking it or filling it.
|
||||||
|
|
||||||
We can create use paths with `beginPath`, `fill`, and `stroke`.
|
We can create and use paths with `beginPath`, `fill`, and `stroke`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
@ -57,8 +57,8 @@ The first example will draw two squares, while the second will only draw one sin
|
|||||||
This fact leads to a common mistake in making `canvas` animations.
|
This fact leads to a common mistake in making `canvas` animations.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var x = 0;
|
const y = 0;
|
||||||
var y = 0;
|
let x = 0;
|
||||||
function draw() {
|
function draw() {
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user