Skip to content

Commit

Permalink
Merge pull request #644 from limzykenneth/main
Browse files Browse the repository at this point in the history
Update to p5.js v1.11.2
  • Loading branch information
limzykenneth authored Nov 28, 2024
2 parents e698b20 + 8a89c9b commit 7b8b92c
Show file tree
Hide file tree
Showing 296 changed files with 15,882 additions and 2,785 deletions.
10,193 changes: 7,775 additions & 2,418 deletions public/reference/data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/search-indices/en.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/search-indices/es.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/search-indices/hi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/search-indices/ko.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/search-indices/zh-Hans.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/content/contributor-docs/en/creating_libraries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ p5.prototype.myMethod = function(){

**Contributed libraries are hosted, documented, and maintained by their creators.** This could be on GitHub, a separate website, or elsewhere. We only feature addon libraries that are fully open source.

**Documentation is key!** The documentation for your library should be easy to find. The documentation for contributed libraries won’t be included in the main p5.js reference, but you may want to follow a similar format. See these examples of a [library overview page](http://p5js.org/reference/#/libraries/p5.sound), [class overview page](http://p5js.org/reference/#/p5.Vector), and [method page](http://p5js.org/reference/#/p5/arc/).
**Documentation is key!** The documentation for your library should be easy to find. The documentation for contributed libraries won’t be included in the main p5.js reference, but you may want to follow a similar format. See these examples of a [library overview page](https://p5js.org/reference/p5.sound), [class overview page](https://p5js.org/reference/p5/p5.Vector), and [method page](https://p5js.org/reference/p5/arc/).

**Examples are great, too!** They show people what your library can do. Because this is all JavaScript, people can see them running online before they download anything.[ ](http://jsfiddle.net/) You can create a collection of examples on the p5.js web editor to showcase how your library works.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Please use American English (color, center, modularize, etc). See [a list of Ame

## Oxford Comma

Please use the [Oxford comma](https://en.wikipedia.org/wiki/Serial_comma) ("red, white, and blue", instead of "red, white and blue").
Please use the [Oxford comma](https://en.wikipedia.org/wiki/Serial_comma/) ("red, white, and blue", instead of "red, white and blue").

**[⬆ back to top](#table-of-contents)**

Expand Down
8 changes: 4 additions & 4 deletions src/content/contributor-docs/en/friendly_error_system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Here, the key is `greeting`, and the variable name is `who`.

To dynamically generate this message, we will need to pass a value:

```JavaScript
```javascript
translator('greeting', { who: 'everyone' } );
```

Expand All @@ -124,7 +124,7 @@ Here is an item from `fes`'s `fileLoadError` that demonstrates interpolation:

To dynamically generate the final message, the FES will call `translator()` with the key and a pre-generated `suggestion` value.

```JavaScript
```javascript
translator('fes.fileLoadError.image', { suggestion });
```

Expand Down Expand Up @@ -177,7 +177,7 @@ For full reference, please see our [Dev Notes].

`fes_core.js/_friendlyError()` prints generated friendly error messages in the console. For example:

```JavaScript
```javascript
p5._friendlyError(
translator('fes.globalErrors.type.notfunc', translationObj)
);
Expand All @@ -193,7 +193,7 @@ There may be cases where you want to [disable the FES for performance].

Example:

```JavaScript
```javascript
p5.disableFriendlyErrors = true;

function setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ In the example above, anything in double angle brackets (`{{}}`) is something th

After adding your case, you can now call `p5._friendlyFileLoadError([case number], [file path])` inside your error handling statements.

For example, please take a look at `loadStrings()` method loading a string-based file (which corresponds to `case 3` from `fileLoadErrorCases`). The  `loadStrings()` method uses [`httpDo.call()`](https://p5js.org/reference/#/p5/httpDo/) with a custom callback method that is executed in the case of a file error:
For example, please take a look at `loadStrings()` method loading a string-based file (which corresponds to `case 3` from `fileLoadErrorCases`). The  `loadStrings()` method uses [`httpDo.call()`](https://p5js.org/reference/p5/httpDo/) with a custom callback method that is executed in the case of a file error:

```js
p5.prototype.httpDo.call(
Expand Down
46 changes: 23 additions & 23 deletions src/content/contributor-docs/zh-Hans/fes_reference_dev_notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ description: >

##### 语法

```JavaScript
```javascript
_report(message)
```

```JavaScript
```javascript
_report(message, func)
```

```JavaScript
```javascript
_report(message, func, color)
```

Expand Down Expand Up @@ -89,15 +89,15 @@ _friendlyError

##### 语法

```JavaScript
```javascript
_friendlyError(message)
```

```JavaScript
```javascript
_friendlyError(message, func)
```

```JavaScript
```javascript
_friendlyError(message, func, color)
```

Expand Down Expand Up @@ -144,7 +144,7 @@ _friendlyFileLoadError

##### 语法

```JavaScript
```javascript
_friendlyFileLoadError(errorType, filePath)
```

Expand All @@ -159,7 +159,7 @@ _friendlyFileLoadError(errorType, filePath)

<ins>文件加载错误示例</ins>

```JavaScript
```javascript
/// missing font file
let myFont;
function preload() {
Expand Down Expand Up @@ -244,7 +244,7 @@ validateParameters

##### 语法

```JavaScript
```javascript
_validateParameters(func, args)
```

Expand All @@ -259,7 +259,7 @@ _validateParameters(func, args)

<ins>缺少参数的示例</ins>

```JavaScript
```javascript
arc(1, 1, 10.5, 10);
```

Expand All @@ -271,7 +271,7 @@ FES将在控制台生成以下消息:
<ins>类型不匹配的示例</ins>

```JavaScript
```javascript
arc('1', 1, 10.5, 10, 0, Math.PI, 'pie');
```

Expand Down Expand Up @@ -323,7 +323,7 @@ try { someCode(); } catch(err) { p5._fesErrorMonitor(err); }

##### 语法

```JavaScript
```javascript
fesErrorMonitor(event)
```

Expand All @@ -337,7 +337,7 @@ fesErrorMonitor(event)

<ins>内部错误示例 1</ins>

```JavaScript
```javascript
function preload() {
// 由于在preload中调用background()而引发
// 错误
Expand All @@ -351,7 +351,7 @@ FES将在控制台中生成以下消息:
<ins>内部错误示例 2</ins>

```JavaScript
```javascript
function setup() {
cnv = createCanvas(200, 200);
cnv.mouseClicked();
Expand All @@ -364,7 +364,7 @@ FES将在控制台中生成以下消息:
<ins>用户示例中的作用域错误示例</ins>

```JavaScript
```javascript
function setup() {
let b = 1;
}
Expand All @@ -379,7 +379,7 @@ FES将在控制台中生成以下消息:
<ins>用户示例中的拼写错误示例</ins>

```JavaScript
```javascript
function setup() {
colour(1, 2, 3);
}
Expand Down Expand Up @@ -414,7 +414,7 @@ core/friendly\_errors/fes\_core.js

<ins>重新定义 p5.js 保留常量的示例</ins>

```JavaScript
```javascript
function setup() {
// PI 是 p5.js 的保留常量
let PI = 100;
Expand All @@ -427,7 +427,7 @@ FES 将在控制台生成以下消息:
<ins>重新定义 p5.js 保留函数的示例</ins>

```JavaScript
```javascript
function setup() {
// text 是 p5.js 的保留函数
let text = 100;
Expand All @@ -452,7 +452,7 @@ core/friendly\_errors/sketch\_reader.js

##### 语法

```JavaScript
```javascript
checkForUserDefinedFunctions(context)
```

Expand All @@ -465,7 +465,7 @@ checkForUserDefinedFunctions(context)

##### 示例

```JavaScript
```javascript
function preLoad() {
loadImage('myimage.png');
}
Expand Down Expand Up @@ -538,7 +538,7 @@ p5.newObject = function(parameter) {

您可以在代码的顶部添加一行代码来禁用此功能:

```JavaScript
```javascript
p5.disableFriendlyErrors = true; // 禁用 FES

function setup() {
Expand All @@ -556,7 +556,7 @@ function draw() {

* FES 可能仍然会导致假阴性的情况。这通常是由于设计与实际使用情况之间的不匹配而导致的(例如,绘图函数最初设计用于在 2D 和 3D 设置中可以互换使用),例如:

```JavaScript
```javascript
const x3; // 未定义
line(0, 0, 100, 100, x3, Math.PI);
```
Expand Down Expand Up @@ -587,7 +587,7 @@ line(0, 0, 100, 100, x3, Math.PI);

* `sketch_reader.js` 可以扩展,可以添加新功能(例如:当用户在 `draw()` 函数中声明变量时向用户发出警告)。以更好地帮助用户。

```JavaScript
```javascript
// 这段代码片段使用新函数包装了 window.console 方法,以修改其功能
// 目前尚未实现,但可以使用它来提供更好格式的错误消息
const original = window.console;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ i18next支持插值,允许我们传递一个变量以动态生成消息。我

为了动态生成该消息,我们需要传递一个值:

```JavaScript
```javascript
translator('greeting', { who: 'everyone' } );
```

Expand All @@ -120,7 +120,7 @@ translator('greeting', { who: 'everyone' } );

为了动态生成最终的消息,FES将使用该键和预先生成的`suggestion`值调用`translator()`

```JavaScript
```javascript
translator('fes.fileLoadError.image', { suggestion });
```

Expand Down Expand Up @@ -173,7 +173,7 @@ p5.js从多个位置调用FES,以处理不同的情况,包括:

`fes_core.js/_friendlyError()` 在控制台中打印生成的友好错误消息。例如:

```JavaScript
```javascript
p5._friendlyError(
translator('fes.globalErrors.type.notfunc', translationObj)
);
Expand All @@ -189,7 +189,7 @@ p5._friendlyError(

示例:

```JavaScript
```javascript
p5.disableFriendlyErrors = true;

function setup() {
Expand Down
3 changes: 3 additions & 0 deletions src/content/people/en/ashish-singh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: ashish singh
url: https://www.linkedin.com/in/ashish1729/
category: contributor
3 changes: 3 additions & 0 deletions src/content/people/en/blackboxlogic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: blackboxlogic
url: http://alexhennings.dev
category: contributor
3 changes: 3 additions & 0 deletions src/content/people/en/luke-plowden.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Luke Plowden
url: http://www.lukeplowden.com
category: contributor
3 changes: 3 additions & 0 deletions src/content/people/en/martin-leopold-groedl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Martin Leopold Groedl
url: https://groedl.xyz
category: contributor
29 changes: 29 additions & 0 deletions src/content/reference/en/p5.Amplitude/toggleNormalize.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: toggleNormalize
module: p5.sound
submodule: p5.sound
file: lib/addons/p5.sound.js
description: |
<p>Determines whether the results of Amplitude.process() will be
Normalized. To normalize, Amplitude finds the difference the
loudest reading it has processed and the maximum amplitude of
1.0. Amplitude adds this difference to all values to produce
results that will reliably map between 0.0 and 1.0. However,
if a louder moment occurs, the amount that Normalize adds to
all the values will change. Accepts an optional boolean parameter
(true or false). Normalizing is off by default.</p>
line: 3264
isConstructor: false
itemtype: method
class: p5.Amplitude
params:
- name: boolean
description: |
<p>set normalize to true (1) or false (0)</p>
type: Boolean
optional: true
chainable: false
---


# toggleNormalize
16 changes: 16 additions & 0 deletions src/content/reference/en/p5.AudioIn/amplitude.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: amplitude
module: p5.sound
submodule: p5.sound
file: lib/addons/p5.sound.js
description: |
<p>Input amplitude, connect to it by default but not to master out</p>
line: 6098
isConstructor: false
itemtype: property
class: p5.AudioIn
type: p5.Amplitude
---


# amplitude
24 changes: 24 additions & 0 deletions src/content/reference/en/p5.AudioIn/connect.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: connect
module: p5.sound
submodule: p5.sound
file: lib/addons/p5.sound.js
description: |
<p>Connect to an audio unit. If no parameter is provided, will
connect to the main output (i.e. your speakers).<br/></p>
line: 6191
isConstructor: false
itemtype: method
class: p5.AudioIn
params:
- name: unit
description: |
<p>An object that accepts audio input,
such as an FFT</p>
type: Object
optional: true
chainable: false
---


# connect
15 changes: 15 additions & 0 deletions src/content/reference/en/p5.AudioIn/currentSource.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: currentSource
module: p5.sound
submodule: p5.sound
file: lib/addons/p5.sound.js
description: ''
line: 6085
isConstructor: false
itemtype: property
class: p5.AudioIn
type: Number|null
---


# currentSource
Loading

0 comments on commit 7b8b92c

Please sign in to comment.