Skip to content

Commit 99a5826

Browse files
authored
Fix ordering in 2.0 example
1 parent 21ae681 commit 99a5826

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ To play around, check out [the example from the p5.js 1.x `preload()` reference]
5252

5353
This is the p5.js 1.x code, and it will result in a blank “Loading…” screen and then show the image:
5454

55-
```
55+
```js
5656
let img;
5757

5858
// Load an image and create a p5.Image object.
@@ -75,16 +75,17 @@ function setup() {
7575

7676
Using p5.js 2.0, and it will result in the red background being shown before the image loads, so people viewing your sketch don’t have to look at a blank screen:
7777

78-
```
78+
```js
7979
let img;
8080

8181
async function setup() {
8282
createCanvas(100, 100);
83-
img = await loadImage('/assets/bricks.jpg');
84-
83+
8584
// Make a red background - in 2.0 will be shown while the image loads
8685
background(255, 0, 0);
8786

87+
img = await loadImage('/assets/bricks.jpg');
88+
8889
// Draw the image.
8990
image(img, 0, 0);
9091

0 commit comments

Comments
 (0)