Skip to content

Commit d875eea

Browse files
committed
Convert JSdoc to MDX
1 parent 63d9350 commit d875eea

125 files changed

Lines changed: 927 additions & 920 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/01_Shapes_And_Color/00_Shape_Primitives/code.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
/**
2-
* @name Shape Primitives
3-
* @description This program demonstrates the use of the basic shape
4-
* primitive functions
5-
* <a href="https://p5js.org/reference/#/p5/square" target="_blank">square()</a>,
6-
* <a href="https://p5js.org/reference/#/p5/rect" target="_blank">rect()</a>,
7-
* <a href="https://p5js.org/reference/#/p5/ellipse" target="_blank">ellipse()</a>,
8-
* <a href="https://p5js.org/reference/#/p5/circle" target="_blank">circle()</a>,
9-
* <a href="https://p5js.org/reference/#/p5/arc" target="_blank">arc()</a>,
10-
* <a href="https://p5js.org/reference/#/p5/line" target="_blank">line()</a>,
11-
* <a href="https://p5js.org/reference/#/p5/triangle" target="_blank">triangle()</a>,
12-
* and <a href="https://p5js.org/reference/#/p5/quad" target="_blank">quad()</a>.
13-
*/
14-
151
function setup() {
162
// Create screen reader accessible description
173
textOutput();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Shape Primitives
3+
one-line-description: Draw 2D shapes.
4+
---
5+
6+
This program demonstrates the use of the basic shape
7+
primitive functions
8+
<a href="https://p5js.org/reference/#/p5/square" target="_blank">square()</a>,
9+
<a href="https://p5js.org/reference/#/p5/rect" target="_blank">rect()</a>,
10+
<a href="https://p5js.org/reference/#/p5/ellipse" target="_blank">ellipse()</a>,
11+
<a href="https://p5js.org/reference/#/p5/circle" target="_blank">circle()</a>,
12+
<a href="https://p5js.org/reference/#/p5/arc" target="_blank">arc()</a>,
13+
<a href="https://p5js.org/reference/#/p5/line" target="_blank">line()</a>,
14+
<a href="https://p5js.org/reference/#/p5/triangle" target="_blank">triangle()</a>,
15+
and <a href="https://p5js.org/reference/#/p5/quad" target="_blank">quad()</a>.

examples/01_Shapes_And_Color/01_Color/code.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
/**
2-
* @name Color
3-
* @description This expands on the Shape Primitives example by adding
4-
* color.
5-
* <a href="https://p5js.org/reference/#/p5/background" target="_blank">background()</a>
6-
* fills the canvas with one color,
7-
* <a href="https://p5js.org/reference/#/p5/stroke" target="_blank">stroke()</a>
8-
* sets the color for drawing lines, and
9-
* <a href="https://p5js.org/reference/#/p5/fill" target="_blank">fill()</a>
10-
* sets the color for the inside of shapes.
11-
* <a href="https://p5js.org/reference/#/p5/noFill" target="_blank">noStroke()</a> and
12-
* <a href="https://p5js.org/reference/#/p5/noFill" target="_blank">noFill()</a>
13-
* turn off line color and inner color, respectively.
14-
*
15-
* Colors can be represented in many different ways. This example demonstrates several options.
16-
*/
17-
181
function setup() {
192
// Create screen reader accessible description
203
textOutput();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Color
3+
one-line-description: Add color to your sketch.
4+
---
5+
6+
This expands on the Shape Primitives example by adding
7+
color.
8+
<a href="https://p5js.org/reference/#/p5/background" target="_blank">background()</a>
9+
fills the canvas with one color,
10+
<a href="https://p5js.org/reference/#/p5/stroke" target="_blank">stroke()</a>
11+
sets the color for drawing lines, and
12+
<a href="https://p5js.org/reference/#/p5/fill" target="_blank">fill()</a>
13+
sets the color for the inside of shapes.
14+
<a href="https://p5js.org/reference/#/p5/noFill" target="_blank">noStroke()</a> and
15+
<a href="https://p5js.org/reference/#/p5/noFill" target="_blank">noFill()</a>
16+
turn off line color and inner color, respectively.
17+
18+
Colors can be represented in many different ways. This example demonstrates several options.

examples/02_Animation_And_Variables/00_Drawing_Lines/code.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
/**
2-
* @name Drawing Lines
3-
* @description Click and drag the mouse to draw a line.
4-
*
5-
* This example demonstrates the use of several built-in
6-
* variables.
7-
* <a href="https://p5js.org/reference/#/p5/mouseX">mouseX</a>
8-
* and
9-
* <a href="https://p5js.org/reference/#/p5/mouseY">mouseY</a>
10-
* store the current mouse position, while the
11-
* previous mouse position is represented by
12-
* <a href="https://p5js.org/reference/#/p5/pmouseX">pmouseX</a>
13-
* and
14-
* <a href="https://p5js.org/reference/#/p5/pmouseY">pmouseY</a>.
15-
*
16-
* This example also shows the use of
17-
* <a href="https://p5js.org/reference/#/p5/colorMode">colorMode</a> with HSB
18-
* (hue-saturation-brightness), so that the first variable sets the hue.
19-
*
20-
*/
211
function setup() {
222
// Create the canvas
233
createCanvas(710, 400);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Drawing Lines
3+
one-line-description: Draw with the mouse.
4+
---
5+
6+
Click and drag the mouse to draw a line.
7+
8+
This example demonstrates the use of several built-in
9+
variables.
10+
<a href="https://p5js.org/reference/#/p5/mouseX">mouseX</a>
11+
and
12+
<a href="https://p5js.org/reference/#/p5/mouseY">mouseY</a>
13+
store the current mouse position, while the
14+
previous mouse position is represented by
15+
<a href="https://p5js.org/reference/#/p5/pmouseX">pmouseX</a>
16+
and
17+
<a href="https://p5js.org/reference/#/p5/pmouseY">pmouseY</a>.
18+
*
19+
This example also shows the use of
20+
<a href="https://p5js.org/reference/#/p5/colorMode">colorMode</a> with HSB
21+
(hue-saturation-brightness), so that the first variable sets the hue.

examples/02_Animation_And_Variables/01_Animation_With_Events/code.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
/**
2-
* @name Animation with Events
3-
* @description This example demonstrates the use of
4-
* <a href="https://p5js.org/reference/#/p5/loop">loop()</a>
5-
* and
6-
* <a href="https://p5js.org/reference/#/p5/noLoop">noLoop()</a>
7-
* to pause and resume the animation.
8-
*
9-
* Clicking the mouse toggles the animation loop. If the animation
10-
* loop is stopped, the user can press any key to advance one frame.
11-
* Note: the user must click to set the focus on the canvas for
12-
* key presses to be registered.
13-
*
14-
* Advancing a single frame is accomplished by calling the
15-
* <a href="https://p5js.org/reference/#/p5/redraw">redraw()</a>
16-
* function, which results in a single call to the draw() function.
17-
*
18-
*/
19-
201
// Declare variable for the horizontal position of the circle
212
let x = 25;
223

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Animation with Events
3+
one-line-description: Pause and resume animation.
4+
---
5+
6+
This example demonstrates the use of
7+
<a href="https://p5js.org/reference/#/p5/loop">loop()</a>
8+
and
9+
<a href="https://p5js.org/reference/#/p5/noLoop">noLoop()</a>
10+
to pause and resume the animation.
11+
12+
Clicking the mouse toggles the animation loop. If the animation
13+
loop is stopped, the user can press any key to advance one frame.
14+
Note: the user must click to set the focus on the canvas for
15+
key presses to be registered.
16+
17+
Advancing a single frame is accomplished by calling the
18+
<a href="https://p5js.org/reference/#/p5/redraw">redraw()</a>
19+
function, which results in a single call to the draw() function.

examples/02_Animation_And_Variables/02_Mobile_Device_Movement/code.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
/**
2-
* @name Mobile Device Movement
3-
* @description The <a href="https://p5js.org/reference/#/p5/deviceMoved" target="_blank">deviceMoved()</a>
4-
* function runs when the mobile device displaying the sketch moves.
5-
* In this example, the
6-
* <a href="https://p5js.org/reference/#/p5/accelerationX" target="_blank">accelerationX</a>,
7-
* <a href="https://p5js.org/reference/#/p5/accelerationY" target="_blank">accelerationY</a>,
8-
* and <a href="https://p5js.org/reference/#/p5/accelerationZ" target="_blank">accelerationZ</a>
9-
* values set the position and size of a circle.
10-
* This only works for mobile devices.
11-
*/
12-
131
function setup() {
142
describe(
153
'Available on mobile devices only: a white circle on a black background that moves and changes size based on the movement of the device.'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Mobile Device Movement
3+
one-line-description: Animate based on device motion.
4+
---
5+
6+
The <a href="https://p5js.org/reference/#/p5/deviceMoved" target="_blank">deviceMoved()</a>
7+
function runs when the mobile device displaying the sketch moves.
8+
In this example, the
9+
<a href="https://p5js.org/reference/#/p5/accelerationX" target="_blank">accelerationX</a>,
10+
<a href="https://p5js.org/reference/#/p5/accelerationY" target="_blank">accelerationY</a>,
11+
and <a href="https://p5js.org/reference/#/p5/accelerationZ" target="_blank">accelerationZ</a>
12+
values set the position and size of a circle.
13+
This only works for mobile devices.

0 commit comments

Comments
 (0)