Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/content_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,40 @@
- Stored in `/src/content/examples/`
- All translations are stored and edited directly in this repo under the corresponding language folder in `/src/content/examples/`

All original examples (created new for p5.js) since 2024 are collectively attributed to p5.js Contributors under the CC-BY-NC-SA 4.0 license. However, examples that build on prior work (under a compatible license) can be attributed in more detail, to make sure that authorship is clear in citation, and code history is available to viewers.

To add attribution, you can use the following block in the headers, listing in chronological order all arrtibutions. Below is the example from `examples/animation-and-variables-conditions/`:

```yaml
remix:
- description: Inspired by
attribution:
- name: Name Name
URL: a-valid-link
code:
- label: pre-2023 code
URL: a-valid-link
- description: Revised by
attribution:
- name: Name Name
URL: a-valid-link
code:
- label: 2023 revision code
URL: a-valid-link

- collectivelyAttributedSince: 2024
```

This will result in a block that lists, in order, the initial inspiration; any revision or other remix; and the collective attribution statement that begins in 2024: "From 2024 onwards, edited and maintained by p5.js Contributors and the Processing Foundation. Licensed under CC BY-NC-SA 4.0."

A remix can be many things ([here is an example analysis of sketch remixing (PDF)](https://dl.acm.org/doi/pdf/10.1145/3563657.3595969)); the `description` will be by default "Remixed by", so a more specific description is recommended.

If the `collectivelyAttributedSince` information is missing, then no year will be included, but the collective attribution statement will still show: "Edited and maintained by p5.js Contributors and the Processing Foundation. Licensed under CC BY-NC-SA 4.0." You'll see this in examples that were part of a major revision project with specific attribution, but have collective authorship before and after.

Each item in the remix history must have an at least one person listed in the attribution section. When multiple people are listed, their names will be shown in that order. For people, URLs are optional but recommended.

---

## Tutorials

- Stored in `/src/content/tutorials/`
Expand Down
29 changes: 29 additions & 0 deletions src/content/examples/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { z, defineCollection, reference } from "astro:content";


/**
* Content collection for the Examples section of the site.
* Each file represents a single example.
Expand All @@ -17,5 +18,33 @@ export const examplesCollection = defineCollection({
relatedReference: z.array(reference("reference")).optional(),
featuredImage: image(),
featuredImageAlt: z.string().optional().default(""),

// Optional list of remixes to add to license
remix: z
.array(
z.object({
description: z.string().default("Remixed by"),
attribution: z
.array(
z.object({
name: z.string(),
URL: z.string().optional(),
})
)
.optional(),
code: z
.array(
z.object({
label: z.string(),
URL: z.string(),
})
)
.optional(),
collectivelyAttributedSince: z.number().optional(),
})
)
.optional()
.default([]),
}),
});

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ oneLineDescription: Draw 2D shapes.
relatedReference:
- en/p5/arc
- en/p5/ellipse

remix:
- description: Revised in 2023 by
attribution:
- name: Darren Kessner
URL: https://github.com/dkessner
- description: Created by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This current credits Darren and me for creating it, and credits Darren for revising it. This reads a bit confusing, especially since this was a rewrite of the example from the old site (my memory is that it shares no specific code but has the same goal. Since the old site did not credit a creator, and Darren did more work on this than me, maybe just credit Darren as "Rewritten by"?

attribution:
- name: Caleb Foss
URL: https://github.com/calebfoss
- name: Darren Kessner
URL: https://github.com/dkessner
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/01_Shapes_And_Color/00_Shape_Primitives
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/01_Form/01_Shape_Primitives.js
- collectivelyAttributedSince: 2024
---

This program demonstrates the use of the basic shape
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ featuredImage: "../../../images/featured/01_Shapes_And_Color-01_Color-thumbnail.
featuredImageAlt: A few basic shapes drawn in different colors over a blue background.
title: Color
oneLineDescription: Add color to your sketch.

remix:
- description: Created by
attribution:
- name: Caleb Foss
URL: https://github.com/calebfoss
- name: Darren Kessner
URL: https://github.com/dkessner
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/01_Shapes_And_Color/01_Color
- collectivelyAttributedSince: 2024

---

This expands on the Shape Primitives example by adding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ featuredImage: "../../../images/featured/02_Animation_And_Variables-00_Drawing_L
featuredImageAlt: A squiggly rainbow line on a black background.
title: Drawing Lines
oneLineDescription: Draw with the mouse.

remix:
- description: Revised by
attribution:
- name: Darren Kessner
URL: https://github.com/dkessner
code:
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/17_Drawing/00_Continuous_Lines.js
- label: 2023 revision code
URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/00_Drawing_Lines
---

Click and drag the mouse to draw a line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ featuredImage: "../../../images/featured/02_Animation_And_Variables-01_Animation
featuredImageAlt: A small green circle on a black background.
title: Animation with Events
oneLineDescription: Pause and resume animation.

remix:
- description: Revised by
attribution:
- name: Darren Kessner
URL: https://github.com/dkessner
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/01_Animation_With_Events
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/00_Structure/06_Redraw.js
---

This example demonstrates the use of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ featuredImageAlt: White circles on a black background, with varying degrees of t
title: Mobile Device Movement
oneLineDescription: Animate based on device motion.
featured: true

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/02_Mobile_Device_Movement
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/35_Mobile/02_Acceleration_Color.js
---

The <a href="https://p5js.org/reference/p5/deviceMoved" target="_blank">deviceMoved()</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ featuredImage: "../../../images/featured/02_Animation_And_Variables-03_Condition
featuredImageAlt: A small black circle on a rainbow, lattice-shaped path, on top of a grey and white striped background.
title: Conditions
oneLineDescription: Use if and else statements to make decisions while your sketch runs.

remix:
- description: Inspired by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grammar here seems to communicate that the example was inspired by Prof. Harris herself. I think most readers would figure out that it's really referring to something she created, but ideally this would read something like:

Inspired by the Conditional Shapes example by Prof. WM Harris

attribution:
- name: Prof. WM Harris
URL: https://people.rit.edu/wmhics/
code:
- URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/04_Control/05_Logical_Operators_2.js
label: pre-2023 code
- description: Revised by
attribution:
- name: Caleb Foss
URL: https://github.com/calebfoss
code:
- URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
label: 2023 revision code
- collectivelyAttributedSince: 2024

---

If and else statements allow a
Expand Down
12 changes: 12 additions & 0 deletions src/content/examples/en/03_Imported_Media/00_Words/description.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ featuredImage: "../../../images/featured/03_Imported_Media-00_Words-thumbnail.pn
featuredImageAlt: Three columns of the words “ichi,” “ni,” “san,” and “shi” on a white background. The first column is right aligned, the middle column is center aligned, and the left column is left aligned.
title: Words
oneLineDescription: Load fonts and draw text.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/01_Shapes_And_Color/01_Color
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/19_Typography/01_Words.js

---

The <a href="https://p5js.org/reference/p5/text" target="_blank">text()</a> function is used for inserting text into the canvas.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ featuredImage: "../../../images/featured/03_Imported_Media-01_Copy_Image_Data-th
featuredImageAlt: Black-and-white photograph of a parrot. A curvy line is drawn across the image; within the confines of that line, color is added to the photograph.
title: Copy Image Data
oneLineDescription: Paint from an image file onto the canvas.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/01_Copy_Image_Data
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/05_Image/10_Copy_Method.js

---

Using the <a href="https://p5js.org/reference/p5/copy" target="_blank">copy()</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ featuredImage: "../../../images/featured/03_Imported_Media-02_Alpha_Mask-thumbna
featuredImageAlt: Two leaf sprigs side by side on a white background. The right sprig is labeled "Mask." The left sprig is labeled "Masked Image," and uses the shape of the right sprig to mask a photograph of tulips.
title: Alpha Mask
oneLineDescription: Use one image to cut out a section of another image.

remix:
- description: Revised by
attribution:
- name: Malay Vasa
URL: https://github.com/Malayvasa
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/02_Alpha_Mask
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/05_Image/03_Alpha_Mask.js

---

Using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ featuredImage: "../../../images/featured/03_Imported_Media-03_Image_Transparency
featuredImageAlt: An astronaut on a planet as the background with a slightly transparent version of this image overlaid and to the left.
title: Image Transparency
oneLineDescription: Make an image translucent on the canvas.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/03_Image_Transparency
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/05_Image/02_Transparency.js
---

This program overlays one image over another by modifying the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ featuredImage: "../../../images/featured/03_Imported_Media-04_Create_Audio-thumb
featuredImageAlt: A close up of an audio player timestamp, reading "0:00 / 2."
title: Audio Player
oneLineDescription: Create a player for an audio file.

remix:
- description: Created by
attribution:
- name: Caleb Foss
URL: https://github.com/calebfoss
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/04_Create_Audio
---

<a href="https://p5js.org/reference/p5/createAudio" target="_blank">createAudio()</a>
Expand Down
12 changes: 12 additions & 0 deletions src/content/examples/en/03_Imported_Media/05_Video/description.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ featuredImage: "../../../images/featured/03_Imported_Media-05_Video-thumbnail.pn
featuredImageAlt: A screenshot of a video of a hand, with the pointer finger touching a desk.
title: Video Player
oneLineDescription: Create a player for a video file.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/05_Video
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/16_Dom/08_Video.js

---

Using the <a href="https://p5js.org/reference/p5/noCanvas" target="_blank">noCanvas()</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ featuredImage: "../../../images/featured/03_Imported_Media-06_Video_Canvas-thumb
featuredImageAlt: Two overlaid screenshots of a video of a hand, with the pointer finger touching a desk. Text to the top right of the screenshot reads "Click the canvas to start and pause the video feed."
title: Video on Canvas
oneLineDescription: Display and stylize a video on the canvas.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/06_Video_Canvas
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/16_Dom/09_Video_Canvas.js

---

Using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ featuredImage: "../../../images/featured/03_Imported_Media-07_Video_Capture-thum
featuredImageAlt: An inverse, black and white photograph of trees.
title: Video Capture
oneLineDescription: Display a live video feed from a camera.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/03_Imported_Media/07_Video_Capture
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/16_Dom/11_Capture.js

---

Using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ featuredImage: "../../../images/featured/04_Input_Elements-00_Image_Drop-thumbna
featuredImageAlt: A grey background with white text reading "Drag an image file onto the canvas."
title: Image Drop
oneLineDescription: Display an image that the page visitor dragged and dropped.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/04_Input_Elements/00_Image_Drop
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/16_Dom/12_Drop.js
---

<a href="https://p5js.org/reference/p5.Element/drop" target="_blank">drop()</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ featuredImage: "../../../images/featured/04_Input_Elements-01_Input_Button-thumb
featuredImageAlt: An input field with a submit button, labeled "Hello, p5!"
title: Input and Button
oneLineDescription: Use text input from the page visitor.

remix:
- description: Revised by
attribution:
- name: Kasey Lichtlyter
URL: https://www.klich.co/
code:
- label: 2023 code
URL: https://github.com/processing/p5.js-example/tree/main/examples/04_Input_Elements/01_Input_Button
- label: pre-2023 code
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/16_Dom/03_Input_Button.js
---

Using the
Expand Down
Loading