Skip to content

Commit 9279c3f

Browse files
committed
Merge branch 'main' of https://github.com/processing/p5.js-website into exampleFixes
2 parents 8902783 + 75f6cc9 commit 9279c3f

File tree

8 files changed

+602
-505
lines changed

8 files changed

+602
-505
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ If you discover a bug or have an idea for a new feature you'd like to add, begin
1010

1111
We recognize all types of contributions. This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Add yourself to the [p5.js repository readme](https://github.com/processing/p5.js/blob/main/README.md#contributors) by following the [instructions here](https://github.com/processing/p5.js/issues/2309)!
1212

13+
## Add Yourself to Contributors
14+
15+
If you've contributed to this website (or any other part of the p5.js project), add yourself [here](https://github.com/processing/p5.js#contributors). Instructions to do this can be found at the bottom of the section.
16+
1317
## Stewards
1418
Stewards are contributors that are particularly involved, familiar, or responsive to certain areas of the project. Their role is to help provide context and guidance to others working on p5.js website. If you have a question about contributing to a particular area, you can tag the listed steward in an issue or pull request. They may also weigh in on feature requests and guide the overall direction of their area, with the input of the community. You can read more about the organization of the project at [contributor_docs/organization.md](https://github.com/processing/p5.js/blob/main/contributor_docs/organization.md).
1519

@@ -44,6 +48,8 @@ Once added, a steward's username will remain in the [stewards section of the rea
4448
Other Language Steward(s):
4549
* Portuguese: [@raphaelavelar](https://github.com/raphaelavelar)
4650

51+
52+
4753
## Setup
4854

4955
1. Install [node.js](https://nodejs.org/en/download/).
@@ -74,13 +80,8 @@ Once you've setup the site, type `npm run watch` to run the website. This should
7480
* [grunt-assemble-i18n](https://github.com/assemble/grunt-assemble-i18n) renders a set of pages for each language specified in the gruntfile, based on the handlebars templates and yml data. There is not a lot of documentation, but this [example](https://github.com/LaurentGoderre/i18n-demo) demonstrates the functionality well.
7581
* [assemble-contrib-permalinks](https://github.com/assemble/assemble-permalinks) allows us to customize the permalinks (file structure of the rendered static site).
7682

77-
## Add yourself to contributors!
78-
79-
If you've contributed to this website (or any other part of the p5.js project), add yourself [here](https://github.com/processing/p5.js#contributors). Instructions to do this can be found at the bottom of the section.
80-
81-
## Etc
82-
* [Instructions for contributing to website translation/internationalization](https://github.com/processing/p5.js-website/blob/main/contributor_docs/i18n_contribution.md)
83-
* [Introducción a p5.js](https://github.com/processing/p5.js-getting-started-es) - The repository for the book and PDF production of [Introducción a p5.js](http://p5js.org/books/).
83+
## Translation/i18n
84+
* [Instructions](https://github.com/processing/p5.js-website/blob/main/contributor_docs/i18n_contribution.md) for contributing to website translation/internationalization
8485

8586
## Externally hosted language versions
8687
* [https://p5js.jp](https://p5js.jp/) - 日本語 (Japanese), translated and hosted by [Katsuya Endoh](https://enkatsu.org/)

src/assets/js/p5.min.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/js/p5.sound.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data/data.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
title: p5.js
2-
version: 1.4.2
2+
version: 1.5.0

src/data/examples/en/09_Simulate/04_GameOfLife.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ let board;
1212
let next;
1313

1414
function setup() {
15+
// Set simulation framerate to 10 to avoid flickering
16+
frameRate(10);
1517
createCanvas(720, 400);
1618
w = 20;
1719
// Calculate columns and rows

src/data/reference/en.json

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@
896896
"AXES": {},
897897
"LABEL": {},
898898
"FALLBACK": {},
899+
"CONTAIN": {},
900+
"COVER": {},
899901
"print": {
900902
"description": [
901903
"The <a href=\"#/p5/print\">print()</a> function writes to the console area of your browser. This function is often helpful for looking at the data a program is producing. This function creates a new line of text for each call to the function. Individual elements can be separated with quotes (\"\") and joined with the addition operator (+).",
@@ -1213,7 +1215,7 @@
12131215
},
12141216
"blendMode": {
12151217
"description": [
1216-
"Blends the pixels in the display window according to the defined mode. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels already in the display window (B): <ul> <li><code>BLEND</code> - linear interpolation of colours: C = A*factor + B. <b>This is the default blending mode.</b></li> <li><code>ADD</code> - sum of A and B</li> <li><code>DARKEST</code> - only the darkest colour succeeds: C = min(A*factor, B).</li> <li><code>LIGHTEST</code> - only the lightest colour succeeds: C = max(A*factor, B).</li> <li><code>DIFFERENCE</code> - subtract colors from underlying image.</li> <li><code>EXCLUSION</code> - similar to <code>DIFFERENCE</code>, but less extreme.</li> <li><code>MULTIPLY</code> - multiply the colors, result will always be darker.</li> <li><code>SCREEN</code> - opposite multiply, uses inverse values of the colors.</li> <li><code>REPLACE</code> - the pixels entirely replace the others and don't utilize alpha (transparency) values.</li> <li><code>REMOVE</code> - removes pixels from B with the alpha strength of A.</li> <li><code>OVERLAY</code> - mix of <code>MULTIPLY</code> and <code>SCREEN </code>. Multiplies dark values, and screens light values. <em>(2D)</em></li> <li><code>HARD_LIGHT</code> - <code>SCREEN</code> when greater than 50% gray, <code>MULTIPLY</code> when lower. <em>(2D)</em></li> <li><code>SOFT_LIGHT</code> - mix of <code>DARKEST</code> and <code>LIGHTEST</code>. Works like <code>OVERLAY</code>, but not as harsh. <em>(2D)</em> </li> <li><code>DODGE</code> - lightens light tones and increases contrast, ignores darks. <em>(2D)</em></li> <li><code>BURN</code> - darker areas are applied, increasing contrast, ignores lights. <em>(2D)</em></li> <li><code>SUBTRACT</code> - remainder of A and B <em>(3D)</em></li> </ul>",
1218+
"Blends the pixels in the display window according to the defined mode. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels already in the display window (B): <ul> <li><code>BLEND</code> - linear interpolation of colours: C = A*factor + B. <b>This is the default blending mode.</b></li> <li><code>ADD</code> - sum of A and B</li> <li><code>DARKEST</code> - only the darkest colour succeeds: C = min(A*factor, B).</li> <li><code>LIGHTEST</code> - only the lightest colour succeeds: C = max(A*factor, B).</li> <li><code>DIFFERENCE</code> - subtract colors from underlying image. <em>(2D)</em></li> <li><code>EXCLUSION</code> - similar to <code>DIFFERENCE</code>, but less extreme.</li> <li><code>MULTIPLY</code> - multiply the colors, result will always be darker.</li> <li><code>SCREEN</code> - opposite multiply, uses inverse values of the colors.</li> <li><code>REPLACE</code> - the pixels entirely replace the others and don't utilize alpha (transparency) values.</li> <li><code>REMOVE</code> - removes pixels from B with the alpha strength of A.</li> <li><code>OVERLAY</code> - mix of <code>MULTIPLY</code> and <code>SCREEN </code>. Multiplies dark values, and screens light values. <em>(2D)</em></li> <li><code>HARD_LIGHT</code> - <code>SCREEN</code> when greater than 50% gray, <code>MULTIPLY</code> when lower. <em>(2D)</em></li> <li><code>SOFT_LIGHT</code> - mix of <code>DARKEST</code> and <code>LIGHTEST</code>. Works like <code>OVERLAY</code>, but not as harsh. <em>(2D)</em> </li> <li><code>DODGE</code> - lightens light tones and increases contrast, ignores darks. <em>(2D)</em></li> <li><code>BURN</code> - darker areas are applied, increasing contrast, ignores lights. <em>(2D)</em></li> <li><code>SUBTRACT</code> - remainder of A and B <em>(3D)</em></li> </ul>",
12171219
"<em>(2D)</em> indicates that this blend mode <b>only</b> works in the 2D renderer. <em>(3D)</em> indicates that this blend mode <b>only</b> works in the WEBGL renderer."
12181220
],
12191221
"params": {
@@ -1577,7 +1579,7 @@
15771579
},
15781580
"createSelect": {
15791581
"description": [
1580-
"Creates a dropdown menu <code>&lt;select&gt;&lt;/select&gt;</code> element in the DOM. It also helps to assign select-box methods to <a href=\"#/p5.Element\">p5.Element</a> when selecting existing select box. <ul> <li><code>.option(name, [value])</code> can be used to set options for the select after it is created.</li> <li><code>.value()</code> will return the currently selected option.</li> <li><code>.selected()</code> will return the current dropdown element which is an instance of <a href=\"#/p5.Element\">p5.Element</a>.</li> <li><code>.selected(value)</code> can be used to make given option selected by default when the page first loads.</li> <li><code>.disable()</code> marks the whole dropdown element as disabled.</li> <li><code>.disable(value)</code> marks a given option as disabled.</li> </ul>"
1582+
"Creates a dropdown menu <code>&lt;select&gt;&lt;/select&gt;</code> element in the DOM. It also assigns select-related methods to <a href=\"#/p5.Element\">p5.Element</a> when selecting an existing select box. Options in the menu are unique by <code>name</code> (the display text). <ul> <li><code>.option(name, [value])</code> can be used to add an option with <code>name</code> (the display text) and <code>value</code> to the select element. If an option with <code>name</code> already exists within the select element, this method will change its value to <code>value</code>.</li> <li><code>.value()</code> will return the currently selected option.</li> <li><code>.selected()</code> will return the current dropdown element which is an instance of <a href=\"#/p5.Element\">p5.Element</a>.</li> <li><code>.selected(value)</code> can be used to make given option selected by default when the page first loads.</li> <li><code>.disable()</code> marks the whole dropdown element as disabled.</li> <li><code>.disable(value)</code> marks a given option as disabled.</li> </ul>"
15811583
],
15821584
"returns": "p5.Element: pointer to <a href=\"#/p5.Element\">p5.Element</a> holding created node",
15831585
"params": {
@@ -1644,8 +1646,6 @@
16441646
"callback": "Function: (Optional) callback function to be called upon 'canplaythrough' event fire, that is, when the browser can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content"
16451647
}
16461648
},
1647-
"VIDEO": {},
1648-
"AUDIO": {},
16491649
"createCapture": {
16501650
"description": [
16511651
"Creates a new HTML5 <code>&lt;video&gt;</code> element that contains the audio/video feed from a webcam. The element is separate from the canvas and is displayed by default. The element can be hidden using .<a href=\"#/p5.Element/hide\">hide()</a>. The feed can be drawn onto the canvas using <a href=\"#/p5/image\">image()</a>. The loadedmetadata property can be used to detect when the element has fully loaded (see second example).",
@@ -2035,11 +2035,28 @@
20352035
"failureCallback": "Function(Event): (Optional) called with event error if the image fails to load."
20362036
}
20372037
},
2038+
"saveGif": {
2039+
"description": [
2040+
"Generates a gif of your current animation and downloads it to your computer!",
2041+
"The duration argument specifies how many seconds you want to record from your animation. This value is then converted to the necessary number of frames to generate it, depending on the value of units. More on that on the next paragraph.",
2042+
"An optional object that can contain two more arguments: delay (number) and units (string).",
2043+
"<code>delay</code>, specifying how much time we should wait before recording",
2044+
"<code>units</code>, a string that can be either 'seconds' or 'frames'. By default it's 'seconds'.",
2045+
"<code>units</code> specifies how the duration and delay arguments will behave. If 'seconds', these arguments will correspond to seconds, meaning that 3 seconds worth of animation will be created. If 'frames', the arguments now correspond to the number of frames you want your animation to be, if you are very sure of this number.",
2046+
"It is not recommended to write this function inside setup, since it won't work properly. The recommended use can be seen in the example, where we use it inside an event function, like keyPressed or mousePressed."
2047+
],
2048+
"params": {
2049+
"filename": "String: File name of your gif",
2050+
"duration": "Number: Duration in seconds that you wish to capture from your sketch",
2051+
"options": "Object: An optional object that can contain two more arguments: delay, specifying how much time we should wait before recording, and units, a string that can be either 'seconds' or 'frames'. By default it's 'seconds'."
2052+
}
2053+
},
20382054
"image": {
20392055
"description": [
20402056
"Draw an image to the p5.js canvas.",
20412057
"This function can be used with different numbers of parameters. The simplest use requires only three parameters: img, x, and y—where (x, y) is the position of the image. Two more parameters can optionally be added to specify the width and height of the image.",
2042-
"This function can also be used with all eight Number parameters. To differentiate between all these parameters, p5.js uses the language of \"destination rectangle\" (which corresponds to \"dx\", \"dy\", etc.) and \"source image\" (which corresponds to \"sx\", \"sy\", etc.) below. Specifying the \"source image\" dimensions can be useful when you want to display a subsection of the source image instead of the whole thing. Here's a diagram to explain further: <img src=\"assets/drawImage.png\"></img>"
2058+
"This function can also be used with eight Number parameters. To differentiate between all these parameters, p5.js uses the language of \"destination rectangle\" (which corresponds to \"dx\", \"dy\", etc.) and \"source image\" (which corresponds to \"sx\", \"sy\", etc.) below. Specifying the \"source image\" dimensions can be useful when you want to display a subsection of the source image instead of the whole thing. Here's a diagram to explain further: <img src=\"assets/drawImage.png\"></img>",
2059+
"This function can also be used to draw images without distorting the orginal aspect ratio, by adding 9th parameter, fit, which can either be COVER or CONTAIN. CONTAIN, as the name suggests, contains the whole image within the specified destination box without distorting the image ratio. COVER covers the entire destination box."
20432060
],
20442061
"params": {
20452062
"img": "p5.Image|p5.Element|p5.Texture: the image to display",
@@ -2054,7 +2071,10 @@
20542071
"sx": "Number: the x-coordinate of the subsection of the source image to draw into the destination rectangle",
20552072
"sy": "Number: the y-coordinate of the subsection of the source image to draw into the destination rectangle",
20562073
"sWidth": "Number: (Optional) the width of the subsection of the source image to draw into the destination rectangle",
2057-
"sHeight": "Number: (Optional) the height of the subsection of the source image to draw into the destination rectangle"
2074+
"sHeight": "Number: (Optional) the height of the subsection of the source image to draw into the destination rectangle",
2075+
"fit": "Constant: (Optional) either CONTAIN or COVER",
2076+
"xAlign": "Constant: (Optional) either LEFT, RIGHT or CENTER default is CENTER",
2077+
"yAlign": "Constant: (Optional) either TOP, BOTTOM or CENTER default is CENTER"
20582078
}
20592079
},
20602080
"tint": {
@@ -3165,7 +3185,7 @@
31653185
],
31663186
"params": {
31673187
"width": "Number: (Optional) width of the box",
3168-
"Height": "Number: (Optional) height of the box",
3188+
"height": "Number: (Optional) height of the box",
31693189
"depth": "Number: (Optional) depth of the box",
31703190
"detailX": "Integer: (Optional) Optional number of triangle subdivisions in x-dimension",
31713191
"detailY": "Integer: (Optional) Optional number of triangle subdivisions in y-dimension"
@@ -3503,7 +3523,7 @@
35033523
},
35043524
"ambientMaterial": {
35053525
"description": [
3506-
"Sets the current material as an ambient material of the given color.",
3526+
"Sets the ambient color of the material.",
35073527
"The ambientMaterial() color is the color the object will reflect under <strong>any</strong> lighting.",
35083528
"Consider an ambientMaterial() with the color yellow (255, 255, 0). If the light emits the color white (255, 255, 255), then the object will appear yellow as it will reflect the red and green components of the light. If the light emits the color red (255, 0, 0), then the object will appear red as it will reflect the red component of the light. If the light emits the color blue (0, 0, 255), then the object will appear black, as there is no component of the light that it can reflect.",
35093529
"You can view more materials in this <a href=\"https://p5js.org/examples/3d-materials.html\">example</a>."
@@ -3518,7 +3538,7 @@
35183538
},
35193539
"emissiveMaterial": {
35203540
"description": [
3521-
"Sets the current material as an emissive material of the given color.",
3541+
"Sets the emissive color of the material.",
35223542
"An emissive material will display the emissive color at full strength regardless of lighting. This can give the appearance that the object is glowing.",
35233543
"Note, \"emissive\" is a misnomer in the sense that the material does not actually emit light that will affect surrounding objects.",
35243544
"You can view more materials in this <a href=\"https://p5js.org/examples/3d-materials.html\">example</a>."
@@ -3534,7 +3554,7 @@
35343554
},
35353555
"specularMaterial": {
35363556
"description": [
3537-
"Sets the current material as a specular material of the given color.",
3557+
"Sets the specular color of the material.",
35383558
"A specular material is reflective (shiny). The shininess can be controlled by the <a href=\"#/p5/shininess\">shininess()</a> function.",
35393559
"Like <a href=\"#/p5/ambientMaterial\">ambientMaterial()</a>, the specularMaterial() color is the color the object will reflect under <a href=\"#/p5/ambientLight\">ambientLight()</a>. However unlike ambientMaterial(), for all other types of lights (<a href=\"#/p5/directionalLight\">directionalLight()</a>, <a href=\"#/p5/pointLight\">pointLight()</a>, <a href=\"#/p5/spotLight\">spotLight()</a>), a specular material will reflect the <strong>color of the light source</strong>. This is what gives it its \"shiny\" appearance.",
35403560
"You can view more materials in this <a href=\"https://p5js.org/examples/3d-materials.html\">example</a>."

0 commit comments

Comments
 (0)