Skip to content

Commit 63f8eea

Browse files
stalgiagcalebfoss
authored andcommitted
Update examples to follow new asset loading pattern
1 parent 61bee97 commit 63f8eea

25 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/content/examples/en/02_Animation_And_Variables/More/Tickle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let message = 'tickle',
1212
y; // x and y coordinates of the text
1313

1414
function preload() {
15-
font = loadFont('assets/SourceSansPro-Regular.otf');
15+
font = loadFont('/assets/SourceSansPro-Regular.otf');
1616
}
1717

1818
function setup() {

src/content/examples/en/03_Imported_Media/00_Words/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let fontsize = 40;
55
function preload() {
66
// Preload the font's file in the canvas's assets directory.
77
// loadFont() accepts .ttf or .otf files.
8-
font = loadFont('assets/SourceSansPro-Regular.otf');
8+
font = loadFont('/assets/SourceSansPro-Regular.otf');
99
}
1010

1111
function setup() {

src/content/examples/en/03_Imported_Media/01_Copy_Image_Data/code.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ function preload() {
55
// Preload the images from the canvas's assets directory.
66
// The bottomImg is the photograph with color,
77
// and the topImg is the black-and-white photograph.
8-
bottomImg = loadImage('assets/parrot-color.png');
9-
topImg = loadImage('assets/parrot-bw.png');
8+
bottomImg = loadImage('/assets/parrot-color.png');
9+
topImg = loadImage('/assets/parrot-bw.png');
1010
}
1111
function setup() {
1212
describe(
@@ -18,7 +18,7 @@ function setup() {
1818
// Hide the cursor and replace it with a picture of
1919
// a paintbrush.
2020
noCursor();
21-
cursor('assets/brush.png', 20, -10);
21+
cursor('/assets/brush.png', 20, -10);
2222

2323
// Load the top image (the black-and-white image).
2424
image(topImg, 0, 0);

src/content/examples/en/03_Imported_Media/02_Alpha_Mask/code.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// assets directory.
33
function preload() {
44
// Photo by Sergey Shmidt, https://unsplash.com/photos/koy6FlCCy5s
5-
img = loadImage('assets/image.jpg');
5+
img = loadImage('/assets/image.jpg');
66

77
// Photo by Mockup Graphics, https://unsplash.com/photos/_mUVHhvBYZ0
8-
imgMask = loadImage('assets/mask.png');
8+
imgMask = loadImage('/assets/mask.png');
99
}
1010

1111
function setup() {

src/content/examples/en/03_Imported_Media/03_Image_Transparency/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let easing = 0.05;
77

88
function preload() {
99
// Load the bottom image from the canvas's assets directory.
10-
img = loadImage('assets/moonwalk.jpg');
10+
img = loadImage('/assets/moonwalk.jpg');
1111
}
1212

1313
function setup() {

src/content/examples/en/03_Imported_Media/04_Create_Audio/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function setup() {
99
// This can also be a URL for a public file
1010
// On the p5 Editor, a file may be uploaded to Sketch Files
1111
// by clicking the > button on the upper left, followed by the + button
12-
audioPlayer = createAudio('assets/piano-loop.mp3');
12+
audioPlayer = createAudio('/assets/piano-loop.mp3');
1313

1414
// Add description for assistive technologies to explain playback speed
1515
audioPlayer.attribute(

src/content/examples/en/03_Imported_Media/More/Background_Image.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function setup() {
1515
// The background image must be the same size as the parameters
1616
// into the createCanvas() method. In this program, the size of
1717
// the image is 720x400 pixels.
18-
bg = loadImage('assets/moonwalk.jpg');
18+
bg = loadImage('/assets/moonwalk.jpg');
1919
createCanvas(720, 400);
2020
}
2121

src/content/examples/en/03_Imported_Media/More/Load_and_Display_Image.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let img; // Declare variable 'img'.
1212

1313
function setup() {
1414
createCanvas(720, 400);
15-
img = loadImage('assets/moonwalk.jpg'); // Load the image
15+
img = loadImage('/assets/moonwalk.jpg'); // Load the image
1616
}
1717

1818
function draw() {

src/content/examples/en/03_Imported_Media/More/Pointillism.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let img;
1212
let smallPoint, largePoint;
1313

1414
function preload() {
15-
img = loadImage('assets/moonwalk.jpg');
15+
img = loadImage('/assets/moonwalk.jpg');
1616
}
1717

1818
function setup() {

src/content/examples/en/05_Transformation/More/Text_Rotation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function setup() {
1717

1818
// Ensure the .ttf or .otf font stored in the assets directory
1919
// is loaded before setup() and draw() are called
20-
font = loadFont('assets/SourceSansPro-Regular.otf');
20+
font = loadFont('/assets/SourceSansPro-Regular.otf');
2121

2222
// Set text characteristics
2323
textFont(font);

0 commit comments

Comments
 (0)