Skip to content

Commit 1aaafd5

Browse files
authored
Merge pull request #58 from processing/mdx-and-one-liners
Convert JSdoc to MDX and add one line descriptions
2 parents d82646b + 5578efb commit 1aaafd5

190 files changed

Lines changed: 1116 additions & 1109 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.

README.md

Lines changed: 24 additions & 24 deletions
Large diffs are not rendered by default.

examples/01_Shapes_And_Color/00_Shape_Primitives.js renamed to 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/00_Shape_Primitives.png renamed to examples/01_Shapes_And_Color/00_Shape_Primitives/thumbnail.png

File renamed without changes.

examples/01_Shapes_And_Color/01_Color.js renamed to 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.
File renamed without changes.

examples/02_Animation_And_Variables/00_Drawing_Lines.js

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function setup() {
2+
// Create the canvas
3+
createCanvas(710, 400);
4+
5+
// Set background to black
6+
background(0);
7+
8+
// Set width of the lines
9+
strokeWeight(10);
10+
11+
// Set color mode to hue-saturation-brightness (HSB)
12+
colorMode(HSB);
13+
14+
// Set screen reader accessible description
15+
describe('A blank canvas where the user draws by dragging the mouse');
16+
}
17+
18+
function mouseDragged() {
19+
// Set the color based on the mouse position, and draw a line
20+
// from the previous position to the current position
21+
let lineHue = mouseX - mouseY;
22+
stroke(lineHue, 90, 90);
23+
line(pmouseX, pmouseY, mouseX, mouseY);
24+
}
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.

0 commit comments

Comments
 (0)