Skip to content

Commit 1c8ec51

Browse files
authored
Merge pull request #610 from shibomb/fix-oldlink/tutorials
Fix broken links in tutorial pages
2 parents 7547a43 + ad51c9a commit 1c8ec51

8 files changed

+22
-22
lines changed

src/content/tutorials/en/color-gradients.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ This tutorial uses the [p5.js Web Editor](https://editor.p5js.org/) and is desig
5858
- See this [example sketch](https://editor.p5js.org/Msqcoding/sketches/mLfhMChZW) that sets up your webcam to display on the canvas. 
5959
- Visit the p5.reference pages for [`.position()`](/reference/p5.Element/position) and [`p5.Element`](/reference/p5/p5.Element) to learn more.
6060
- Create a function to take a snapshot with your webcam.
61-
- Declare a global [Boolean](/reference/p5/boolean) variable called `snapped` and assign it a value of `false`.
61+
- Declare a global [Boolean](/reference/p5/Boolean) variable called `snapped` and assign it a value of `false`.
6262
- This variable will keep track of when a snapshot is taken and is known as a [state](https://developer.mozilla.org/en-US/docs/Glossary/State_machine) variable.
6363
- Visit the MDN glossary for [state machine](https://developer.mozilla.org/en-US/docs/Glossary/State_machine) for more information about states.
6464
- Define a function called `takeSnap()` below your `setup()` function.

src/content/tutorials/en/conditionals-and-interactivity.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ if (sunHeight < horizon) {
471471

472472
In the code above, we see that if the sun is above the horizon, `sunHeight < horizon `returns `true`, and the code `background("lightblue")` runs. When `sunHeight` is NOT less than the horizon the code block after the `else` keyword, `background(0)`, runs. Although both ways of writing the code have the same visual effect, sometimes it can be clearer and more efficient to use if-else, especially when two different code blocks can be controlled. 
473473

474-
Visit the p5.js reference page for [`if`](/reference/p5/if-else) and [`Boolean`](/reference/p5/boolean) to learn more.
474+
Visit the p5.js reference page for [`if`](/reference/p5/if) and [`Boolean`](/reference/p5/Boolean) to learn more.
475475

476476

477477
#### Step Four: Add grass to hide the sun  

src/content/tutorials/en/coordinates-and-transformations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function draw() {
4949

5050
![An illustration showing a 2D coordinate system on the left, showing an origin of (0,0) at its top left, and a 3D coordinate system on the right, showing an origin of (0,0,0) in its center](../images/webgl/2d3d_coordinates.png)
5151

52-
You can call [`debugMode()`](https://p5js.org/reference/#/p5/debugMode) in your `setup()` function to add a grid on the x- and z-axes and the red-green-blue x, y, and z arrows to your sketch, similar to the illustration above.
52+
You can call [`debugMode()`](https://p5js.org/reference/p5/debugMode) in your `setup()` function to add a grid on the x- and z-axes and the red-green-blue x, y, and z arrows to your sketch, similar to the illustration above.
5353

5454

5555
## Transformations: Position and Size of 3D Shapes

src/content/tutorials/en/field-guide-to-debugging.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function draw() {
244244
<Column>
245245
#### Solution:
246246
247-
The programmer solved the problem by adding a parenthesis between the last argument and a semicolon. They discovered this by visiting the p5.js reference page for [`rect()`](https://p5js.org/reference/#/p5/rect) and comparing code.
247+
The programmer solved the problem by adding a parenthesis between the last argument and a semicolon. They discovered this by visiting the p5.js reference page for [`rect()`](https://p5js.org/reference/p5/rect) and comparing code.
248248
249249
#### Pro Tips:
250250
@@ -283,7 +283,7 @@ p5.js says: [sketch.js, line 9] circle() was expecting at least 3 arguments but
283283
284284
#### Bug:
285285
286-
According to the message in the console, [`circle()`](https://p5js.org/reference/#/p5/circle) only received 2 inputs when it expected 3. The message also specifies that the error is on line 9 of the sketch. 
286+
According to the message in the console, [`circle()`](https://p5js.org/reference/p5/circle) only received 2 inputs when it expected 3. The message also specifies that the error is on line 9 of the sketch. 
287287
288288
</Column>
289289
<Column>
@@ -306,9 +306,9 @@ function draw() {
306306
<Column>
307307
#### Solution:
308308
309-
The programmer solved the problem by adding a third argument in [`circle()`](https://p5js.org/reference/#/p5/circle).
309+
The programmer solved the problem by adding a third argument in [`circle()`](https://p5js.org/reference/p5/circle).
310310
311-
They discovered this by visiting the p5.js reference page for [`circle()`](https://p5js.org/reference/#/p5/circle) and comparing code.
311+
They discovered this by visiting the p5.js reference page for [`circle()`](https://p5js.org/reference/p5/circle) and comparing code.
312312
313313
#### Pro Tips:
314314
@@ -376,9 +376,9 @@ function draw() {
376376
<Column>
377377
#### Solution:
378378
379-
The programmer solved the problem by adding a *closing curly bracket* (`}`) on line 11 to close the [`draw()`](https://p5js.org/reference/#/p5/draw) function.
379+
The programmer solved the problem by adding a *closing curly bracket* (`}`) on line 11 to close the [`draw()`](https://p5js.org/reference/p5/draw) function.
380380
381-
They discovered this by visiting the p5.js reference page for [`draw()`](https://p5js.org/reference/#/p5/draw) and comparing code.
381+
They discovered this by visiting the p5.js reference page for [`draw()`](https://p5js.org/reference/p5/draw) and comparing code.
382382
383383
#### Pro Tips:
384384
@@ -489,7 +489,7 @@ p5.js says: [sketch.js, line 10] circle() was expecting Number for the first par
489489
490490
#### Bug:
491491
492-
According to the message in the console, the programmer made an error on line 10 - the [circle()](https://p5js.org/reference/#/p5/circle) function needs a [number](https://p5js.org/reference/#/p5/number) as the first parameter, but it was given a [string](https://p5js.org/reference/#/p5/string).
492+
According to the message in the console, the programmer made an error on line 10 - the [circle()](https://p5js.org/reference/p5/circle) function needs a [number](https://p5js.org/reference/p5/number) as the first parameter, but it was given a [string](https://p5js.org/reference/p5/string).
493493
494494
</Column>
495495
<Column>
@@ -516,7 +516,7 @@ function draw() {
516516
517517
#### Solution:
518518
519-
The programmer solved the problem by noticing that the variable `myX` was initialized with `"forty-five"`, which cannot be recognized as a [number](https://p5js.org/reference/#/p5/number). p5.js thinks it’s just a word with a [string](https://p5js.org/reference/#/p5/string) data type.
519+
The programmer solved the problem by noticing that the variable `myX` was initialized with `"forty-five"`, which cannot be recognized as a [number](https://p5js.org/reference/p5/number). p5.js thinks it’s just a word with a [string](https://p5js.org/reference/p5/string) data type.
520520
521521
#### Pro Tip:
522522
@@ -589,7 +589,7 @@ function draw() {
589589
590590
#### Solution:
591591
592-
The programmer solved the problem by declaring `localVariable` outside of [`setup()`](https://p5js.org/reference/#/p5/setup) and [`draw()`](https://p5js.org/reference/#/p5/draw) and initializing it in [`setup()`](https://p5js.org/reference/#/p5/setup).
592+
The programmer solved the problem by declaring `localVariable` outside of [`setup()`](https://p5js.org/reference/p5/setup) and [`draw()`](https://p5js.org/reference/p5/draw) and initializing it in [`setup()`](https://p5js.org/reference/p5/setup).
593593
594594
#### Pro Tip:
595595

src/content/tutorials/en/intro-to-shaders.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ A shader program consists of two parts, a **vertex shader** and a **fragment sha
9595

9696
</table>
9797

98-
{ /* Note for contributors: Images/gifs generated from https://editor.p5js.org/davepagurek/sketches/gs-DbLzqV */}
98+
{/* Note for contributors: Images/gifs generated from https://editor.p5js.org/davepagurek/sketches/gs-DbLzqV */}
9999

100100
Each of these live in separate files and are loaded into p5.js using the `loadShader()` function. Once a shader is loaded, it can be used within `setup()` or `draw()`. The following example will show how to set up a basic shader within p5.js:
101101

@@ -671,7 +671,7 @@ In p5.js, a filter is something that looks at all the pixels on the canvas and t
671671

672672
Filter shaders only need a fragment shader. Vertex shaders are primarily responsible for positioning shapes, and filters always apply to the whole canvas, so p5.js provides a default vertex shader for you. Rather than using `loadShader`, you use `createFilterShader(src)`, passing in a string with your shader source code.
673673

674-
There are a number of `uniform`s that will be available to you in a filter shader, and you can read about all of them [in the `createFilterShader` documentation.](https://p5js.org/reference/#/p5/createFilterShader) There are two main ones to know about to get started:
674+
There are a number of `uniform`s that will be available to you in a filter shader, and you can read about all of them [in the `createFilterShader` documentation.](https://p5js.org/reference/p5/createFilterShader) There are two main ones to know about to get started:
675675

676676
- `uniform sampler2D tex0` is a texture containing the contents of the canvas.
677677
- `varying vec2 vTexCoord` contains the coordinates on the canvas of the current pixel, ranging from 0 to 1.

src/content/tutorials/en/layered-rendering-with-framebuffers.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Final image with focal blur using color + depth
7373

7474
</table>
7575

76-
{ /*Note for contributors: Image generated from https://editor.p5js.org/davepagurek/sketches/OUBu-yXuk*/}
76+
{/*Note for contributors: Image generated from https://editor.p5js.org/davepagurek/sketches/OUBu-yXuk*/}
7777

7878
## Using a `p5.Framebuffer`
7979

@@ -366,7 +366,7 @@ function draw() {
366366
`} />
367367

368368
<Callout>
369-
Lots of music player software uses feedback to create audio visualizations. Try using feedback in a sketch that [reacts to music!](https://p5js.org/reference/#/p5.Amplitude)
369+
Lots of music player software uses feedback to create audio visualizations. Try using feedback in a sketch that [reacts to music!](https://p5js.org/reference/p5.sound/p5.Amplitude)
370370
</Callout>
371371

372372
Here are some tips that will help as you create more advanced feedback effects.
@@ -541,7 +541,7 @@ function draw() {
541541
}
542542
`} />
543543

544-
If you want to customize how close to or far from the camera an object needs to be to get depth values of 0 or 1, specify near and far values in [`perspective()`](https://p5js.org/reference/#/p5/perspective).
544+
If you want to customize how close to or far from the camera an object needs to be to get depth values of 0 or 1, specify near and far values in [`perspective()`](https://p5js.org/reference/p5/perspective).
545545

546546
*Depth-based blur shaders are more advanced and are beyond the scope of this tutorial.*
547547

src/content/tutorials/en/repeating-with-loops.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ In this tutorial, you will:
3636

3737
- Draw and update repetitive tasks and shapes using *for loops*
3838
- Use custom functions to update variables and program states and make changes in the program as the sketch runs.
39-
- Use [conditional statements](/reference/p5/if-else) and `random()` to generate different outcomes
40-
- Run and stop your sketch using mouse triggers and [Boolean variables](/reference/p5/boolean)
39+
- Use [conditional statements](/reference/p5/if) and `random()` to generate different outcomes
40+
- Run and stop your sketch using mouse triggers and [Boolean variables](/reference/p5/Boolean)
4141
- Store the positions of the caterpillars in an array
4242

4343
### What you’ll need
@@ -162,7 +162,7 @@ function draw() {
162162
}
163163
`} />
164164

165-
### [If-statements](/reference/p5/if-else)
165+
### [If-statements](/reference/p5/if)
166166

167167
If-statements, like the one applied above, refer to blocks of code that are executed only when a given condition is true. It is normally written:
168168

@@ -174,7 +174,7 @@ if (<condition>) {
174174

175175
The condition is specified inside the parentheses of the if-statement. The curly brackets `{ }` mark the start and end of the block of code. In Step 2, the condition `circX > finishLine` stops `draw()` from running again when the x-coordinate of the circle is greater than the value of `finishLine` by calling `noLoop()`.
176176

177-
Visit the p5.js reference for [if](/reference/p5/if-else) to learn more.
177+
Visit the p5.js reference for [if](/reference/p5/if) to learn more.
178178

179179

180180
## Step 3 – Draw one caterpillar

src/content/tutorials/en/responding-to-inputs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ function checkSelf() {
381381
- It sets the initial direction to the right  with `snake.xSpeed = 1` and `snake.ySpeed = 0`
382382
- It creates an empty array to manage the snake’s body, creates a head segment with the current position, and adds it to the body array.
383383

384-
The `checkEdges()` function uses [if-statements](/reference/p5/if-else) to check if the snake has reached the right edge (`cols`), if the snake has reached the left edge (`-1`), if the snake has reached the top edge (`-1`), and if the snake has reached the bottom edge (`rows`). Whenever any of the conditions are met, it sets `gameOver` to `true`. This creates the rule in the game where if the snake reaches any edge, the game is over. The `moveSnake()` function updates the snake’s position based on its current speed. It updates the x and y positions by adding its `xSpeed` and `ySpeed`, respectively. Refer to the [Conditions and Interactivity](/tutorials/conditionals-and-interactivity/) tutorial to review the syntax for if-statements and updating variables.
384+
The `checkEdges()` function uses [if-statements](/reference/p5/if) to check if the snake has reached the right edge (`cols`), if the snake has reached the left edge (`-1`), if the snake has reached the top edge (`-1`), and if the snake has reached the bottom edge (`rows`). Whenever any of the conditions are met, it sets `gameOver` to `true`. This creates the rule in the game where if the snake reaches any edge, the game is over. The `moveSnake()` function updates the snake’s position based on its current speed. It updates the x and y positions by adding its `xSpeed` and `ySpeed`, respectively. Refer to the [Conditions and Interactivity](/tutorials/conditionals-and-interactivity/) tutorial to review the syntax for if-statements and updating variables.
385385

386386
- The `updateBody()` function updates the positions of the snake’s body segments. It does this by iterating through the snake `body` array starting from the end, updating each body segment’s position to match the position of the segment in front of it. Then it updates the head’s position to the snake’s current position. Refer to the [Repeating with Loops](/tutorials/repeating-with-loops) tutorial to review the syntax for loops and iteration.
387387
- The `drawSnake()` function renders the snake on the canvas. It sets the color to green, iterates through each body segment, and draws a square on the canvas at its position.

0 commit comments

Comments
 (0)