-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Updating all the broken refrence examples. #7739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-2.0
Are you sure you want to change the base?
Changes from all commits
81ff09d
77a1492
302e25b
ade54ac
9df7595
28cf83f
5d2aad1
9e7445f
12a6a17
8f017b0
eaedc0a
2abbd76
7b5d67c
c3851b3
dac7ff2
d19fefc
e4acb5f
9039796
63af24e
24763af
301d42f
dd6a988
58e8746
25b164e
bf86b77
289c176
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,9 +462,10 @@ for (const k in constants) { | |
* ``` | ||
* | ||
* Code placed in `setup()` will run once before code placed in | ||
* <a href="#/p5/draw">draw()</a> begins looping. If the | ||
* <a href="#/p5/preload">preload()</a> is declared, then `setup()` will | ||
* run immediately after <a href="#/p5/preload">preload()</a> finishes | ||
* <a href="#/p5/draw">draw()</a> begins looping. When `setup()` is declared async, | ||
* execution pauses at each `await` until the promise resolves, ensuring all assets | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, providing a bit of explanation on promise: "execution pauses at each Feel free to rephrase of course. |
||
* are loaded before the sketch continues. | ||
* | ||
* loading assets. | ||
* | ||
* Note: `setup()` doesn’t have to be declared, but it’s common practice to do so. | ||
|
@@ -535,7 +536,6 @@ for (const k in constants) { | |
* </code> | ||
* </div> | ||
*/ | ||
|
||
/** | ||
* A function that's called repeatedly while the sketch runs. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,7 +352,7 @@ function dom(p5, fn){ | |
* let slider; | ||
* | ||
* function setup() { | ||
* createCanvas(100, 100); | ||
* createCanvas(200, 200); | ||
* | ||
* // Create a paragraph element and place | ||
* // it at the top of the canvas. | ||
|
@@ -596,7 +596,7 @@ function dom(p5, fn){ | |
* 'https://p5js.org/assets/img/asterisk-01.png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broken URL; maybe grab an image from another part of the reference that works? eg from https://beta.p5js.org/reference/p5/image/? |
||
* 'The p5.js magenta asterisk.' | ||
* ); | ||
* img.position(0, -10); | ||
* img.position(0, 10); | ||
* | ||
* describe('A gray square with a magenta asterisk in its center.'); | ||
* } | ||
|
@@ -945,7 +945,7 @@ function dom(p5, fn){ | |
* | ||
* // Create a checkbox and place it beneath the canvas. | ||
* checkbox = createCheckbox(); | ||
* checkbox.position(0, 100); | ||
* checkbox.position(0, 70); | ||
* | ||
* describe('A black square with a checkbox beneath it. The square turns white when the box is checked.'); | ||
* } | ||
|
@@ -971,7 +971,7 @@ function dom(p5, fn){ | |
* // Create a checkbox and place it beneath the canvas. | ||
* // Label the checkbox "white". | ||
* checkbox = createCheckbox(' white'); | ||
* checkbox.position(0, 100); | ||
* checkbox.position(0, 70); | ||
* | ||
* describe('A black square with a checkbox labeled "white" beneath it. The square turns white when the box is checked.'); | ||
* } | ||
|
@@ -997,7 +997,7 @@ function dom(p5, fn){ | |
* // Create a checkbox and place it beneath the canvas. | ||
* // Label the checkbox "white" and set its value to true. | ||
* checkbox = createCheckbox(' white', true); | ||
* checkbox.position(0, 100); | ||
* checkbox.position(0, 70); | ||
* | ||
* describe('A white square with a checkbox labeled "white" beneath it. The square turns black when the box is unchecked.'); | ||
* } | ||
|
@@ -1876,7 +1876,7 @@ function dom(p5, fn){ | |
* let img; | ||
* | ||
* function setup() { | ||
* createCanvas(100, 100); | ||
* createCanvas(200, 200); | ||
* | ||
* // Create a file input and place it beneath | ||
* // the canvas. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,18 +142,18 @@ function acceleration(p5, fn){ | |
* @example | ||
* <div> | ||
* <code> | ||
* let rotationX = 0; // Angle in degrees | ||
* | ||
* function setup() { | ||
* createCanvas(100, 100, WEBGL); | ||
* createCanvas(200, 200, WEBGL); // Create 3D canvas | ||
* } | ||
* | ||
* function draw() { | ||
* background(200); | ||
* //rotateZ(radians(rotationZ)); | ||
* rotateX(radians(rotationX)); | ||
* //rotateY(radians(rotationY)); | ||
* box(200, 200, 200); | ||
* describe(`red horizontal line right, green vertical line bottom. | ||
* black background.`); | ||
* background(220); // Set light gray background | ||
* rotateX(radians(rotationX)); // Rotate around X-axis | ||
* normalMaterial(); // Apply simple shaded material | ||
* box(60); // Draw 3D cube (60 units wide) | ||
* rotationX = (rotationX + 2) % 360; // Increment rotation (2° per frame) | ||
* } | ||
* </code> | ||
* </div> | ||
|
@@ -175,18 +175,18 @@ function acceleration(p5, fn){ | |
* @example | ||
* <div> | ||
* <code> | ||
* let rotationY = 0; // Angle in degrees | ||
* | ||
* function setup() { | ||
* createCanvas(100, 100, WEBGL); | ||
* createCanvas(200, 200, WEBGL); // Create 3D canvas | ||
* } | ||
* | ||
* function draw() { | ||
* background(200); | ||
* //rotateZ(radians(rotationZ)); | ||
* //rotateX(radians(rotationX)); | ||
* rotateY(radians(rotationY)); | ||
* box(200, 200, 200); | ||
* describe(`red horizontal line right, green vertical line bottom. | ||
* black background.`); | ||
* background(220); // Set light gray background | ||
* rotateY(radians(rotationY)); // Rotate around Y-axis (vertical) | ||
* normalMaterial(); // Apply simple shaded material | ||
* box(60); // Draw 3D cube (60 units wide) | ||
* rotationY = (rotationY + 2) % 360; // Increment rotation (2° per frame) | ||
* } | ||
* </code> | ||
* </div> | ||
|
@@ -209,18 +209,18 @@ function acceleration(p5, fn){ | |
* @example | ||
* <div> | ||
* <code> | ||
* let rotationZ = 0; // Angle in degrees | ||
* | ||
* function setup() { | ||
* createCanvas(100, 100, WEBGL); | ||
* createCanvas(200, 200, WEBGL); // Create 3D canvas | ||
* } | ||
* | ||
* function draw() { | ||
* background(200); | ||
* rotateZ(radians(rotationZ)); | ||
* //rotateX(radians(rotationX)); | ||
* //rotateY(radians(rotationY)); | ||
* box(200, 200, 200); | ||
* describe(`red horizontal line right, green vertical line bottom. | ||
* black background.`); | ||
* background(220); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, thank you for the expanded example 👍 |
||
* rotateZ(radians(rotationZ)); // Rotate around Z-axis | ||
* normalMaterial(); // Apply simple shaded material | ||
* box(60); // Draw 3D cube | ||
* rotationZ = (rotationZ + 2) % 360; // Increment rotation angle | ||
* } | ||
* </code> | ||
* </div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a slightly more precise description:
"When
setup()
uses theasync
keyword (like this:async function setup()
instead offunction setup()
)...."