Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions files/en-us/web/api/path2d/path2d/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ new Path2D(d)

This example creates and copies a `Path2D` path.

```html hidden
<canvas id="canvas"></canvas>
```html
<canvas id="my-canvas"></canvas>
```

```js
const canvas = document.getElementById("canvas");
const canvas = document.getElementById("my-canvas");
const ctx = canvas.getContext("2d");

let path1 = new Path2D();
const path1 = new Path2D();
path1.rect(10, 10, 100, 100);

let path2 = new Path2D(path1);
const path2 = new Path2D(path1);
path2.moveTo(220, 60);
path2.arc(170, 60, 50, 0, 2 * Math.PI);

Expand All @@ -62,15 +62,15 @@ point (`M10 10`) and then move horizontally 80 points to the right
(`h 80`), then 80 points down (`v 80`), then 80 points to the left
(`h -80`), and then back to the start (`Z`).

```html hidden
<canvas id="canvas"></canvas>
```html
<canvas id="my-canvas"></canvas>
```

```js
const canvas = document.getElementById("canvas");
const canvas = document.getElementById("my-canvas");
const ctx = canvas.getContext("2d");

let p = new Path2D("M10 10 h 80 v 80 h -80 Z");
const p = new Path2D("M10 10 h 80 v 80 h -80 Z");
ctx.fill(p);
```

Expand Down