Skip to content

Commit 341d50f

Browse files
authored
Merge branch '2.0' into beta-npm-version
2 parents 02eb14d + 9c7abd0 commit 341d50f

Some content is hidden

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

57 files changed

+951
-1070
lines changed

public/reference/data.json

+119-268
Large diffs are not rendered by default.

public/search-indices/en.json

+1-1
Large diffs are not rendered by default.

public/search-indices/es.json

+1-1
Large diffs are not rendered by default.

public/search-indices/hi.json

+1-1
Large diffs are not rendered by default.

public/search-indices/ko.json

+1-1
Large diffs are not rendered by default.

public/search-indices/zh-Hans.json

+1-1
Large diffs are not rendered by default.

src/components/CodeEmbed/frame.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useRef, useLayoutEffect, useEffect } from "preact/hooks";
1+
import { useRef, useLayoutEffect, useEffect, useState } from "preact/hooks";
22
import { cdnLibraryUrl } from "@/src/globals/globals";
33

44
interface CodeBundle {
@@ -86,6 +86,7 @@ export const CodeFrame = (props: CodeFrameProps) => {
8686
const p5ScriptTag = document.getElementById(
8787
"p5ScriptTag",
8888
) as HTMLScriptElement;
89+
const [mounted, setMounted] = useState(false);
8990

9091
// For performance, set the iframe to display:none when
9192
// not visible on the page. This will stop the browser
@@ -101,11 +102,7 @@ export const CodeFrame = (props: CodeFrameProps) => {
101102
(entries) => {
102103
entries.forEach((entry) => {
103104
if (!iframeRef.current) return;
104-
if (entry.isIntersecting) {
105-
iframeRef.current.style.removeProperty("display");
106-
} else {
107-
iframeRef.current.style.display = "none";
108-
}
105+
setMounted(entry.isIntersecting);
109106
});
110107
},
111108
{ rootMargin: "20px" },
@@ -118,6 +115,7 @@ export const CodeFrame = (props: CodeFrameProps) => {
118115
useEffect(() => {
119116
(async () => {
120117
if (!p5ScriptTag || !iframeRef.current) return;
118+
if (!mounted) return;
121119

122120
/*
123121
* Uses postMessage to receive the text content of p5.min.js, to be included
@@ -148,7 +146,7 @@ export const CodeFrame = (props: CodeFrameProps) => {
148146
return;
149147
}
150148
})();
151-
}, [props.jsCode]);
149+
}, [props.jsCode, mounted]);
152150

153151
return (
154152
<div
@@ -157,13 +155,13 @@ export const CodeFrame = (props: CodeFrameProps) => {
157155
>
158156
<iframe
159157
ref={iframeRef}
160-
srcDoc={wrapInMarkup({
158+
srcDoc={mounted ? wrapInMarkup({
161159
js: props.jsCode,
162160
css: props.cssCode,
163161
htmlBody: props.htmlBodyCode,
164162
base: props.base,
165163
scripts: props.scripts,
166-
})}
164+
}) : undefined}
167165
sandbox="allow-scripts allow-popups allow-modals allow-forms allow-same-origin"
168166
aria-label="Code Preview"
169167
title="Code Preview"
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Aaron Welles
2+
url: ''
3+
category: contributor
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Carrie Wang
2+
url: https://github.com/re7l
3+
category: contributor

src/content/people/en/chloe-yan.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Chloe Yan
2+
url: https://github.com/ChloeYanYan
3+
category: contributor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Franolich Design
2+
url: https://github.com/franolichdesign
3+
category: contributor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Himanshu Kholiya
2+
url: https://github.com/himanshuukholiya
3+
category: contributor

src/content/people/en/jackie-liu.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Jackie Liu
2+
url: https://github.com/jlliu
3+
category: contributor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Lauren Berrios
2+
url: https://github.com/lab-mediaArts
3+
category: contributor

src/content/people/en/mclark414.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: mclark414
2+
url: https://github.com/mclark414
3+
category: contributor

src/content/people/en/mx--ramsey.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Mx. Ramsey
2+
url: https://github.com/mxramsey
3+
category: contributor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Qingfeng Huang
2+
url: https://git.arts.ac.uk/pages/21034426/My_Portfolio_Website/
3+
category: contributor

src/content/people/en/roxi09.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: roxi09
2+
url: https://github.com/Roxi09
3+
category: contributor

src/content/people/en/vik.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Vik
2+
url: https://github.com/HritvikBhatia
3+
category: contributor
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: Xevi H. Aqeel
2+
url: http://kinardist.media
3+
category: contributor

src/content/reference/en/p5.Font/textToContours.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ example:
5959
6060
async function setup() {
6161
createCanvas(100, 100);
62-
font = await loadFont('//assets/inconsolata.otf');
62+
font = await loadFont('/assets/inconsolata.otf');
6363
}
6464
6565
function draw() {

src/content/reference/en/p5.Oscillator/start.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Starts the oscillator. Usually from user gesture.
7-
line: 168
7+
line: 169
88
isConstructor: false
99
itemtype: method
1010
example:

src/content/reference/en/p5.Oscillator/stop.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Stops the oscillator.
7-
line: 193
7+
line: 194
88
isConstructor: false
99
itemtype: method
1010
class: p5.Oscillator

src/content/reference/en/p5.sound/p5.SawOsc.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Creates a sawtooth oscillator.
7-
line: 219
7+
line: 220
88
isConstructor: true
99
params:
1010
- name: freq

src/content/reference/en/p5.sound/p5.SinOsc.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Creates a sine oscillator.
7-
line: 261
7+
line: 262
88
isConstructor: true
99
params:
1010
- name: freq

src/content/reference/en/p5.sound/p5.SqrOsc.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Creates a square oscillator.
7-
line: 233
7+
line: 234
88
isConstructor: true
99
params:
1010
- name: freq

src/content/reference/en/p5.sound/p5.TriOsc.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module: p5.sound
44
submodule: p5.sound
55
file: src/Oscillator.js
66
description: Creates a triangle oscillator.
7-
line: 247
7+
line: 248
88
isConstructor: true
99
params:
1010
- name: freq

src/content/reference/en/p5/beginContour.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ description: >
4747
clockwise order. Then, draw vertices for the negative space in
4848
4949
counter-clockwise order.</p>
50-
line: 1957
50+
line: 2487
5151
isConstructor: false
5252
itemtype: method
5353
example:
@@ -74,7 +74,7 @@ example:
7474
vertex(30, 70);
7575
vertex(70, 70);
7676
vertex(70, 30);
77-
endContour();
77+
endContour(CLOSE);
7878
7979
// Stop drawing the shape.
8080
endShape(CLOSE);
@@ -115,7 +115,7 @@ example:
115115
vertex(-20, 20);
116116
vertex(20, 20);
117117
vertex(20, -20);
118-
endContour();
118+
endContour(CLOSE);
119119
120120
// Stop drawing the shape.
121121
endShape(CLOSE);

src/content/reference/en/p5/beginShape.mdx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: beginShape
33
module: Shape
4-
submodule: Vertex
4+
submodule: Custom Shapes
55
file: src/shape/vertex.js
66
description: >
77
<p>Begins adding vertices to a custom shape.</p>
@@ -34,8 +34,6 @@ description: >
3434
3535
<a href="/reference/p5/vertex/">vertex()</a>,
3636
37-
<a href="/reference/p5/bezierVertex/">bezierVertex()</a>,
38-
3937
<a href="/reference/p5/bezierVertex/">bezierVertex()</a>, and/or
4038
4139
<a href="/reference/p5/splineVertex/">splineVertex()</a>. Calling
@@ -63,7 +61,7 @@ description: >
6361
and
6462
6563
<a href="/reference/p5/endShape/">endShape()</a>.</p>
66-
line: 400
64+
line: 399
6765
isConstructor: false
6866
itemtype: method
6967
example:

src/content/reference/en/p5/bezierOrder.mdx

+83-9
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,98 @@ title: bezierOrder
33
module: Shape
44
submodule: Custom Shapes
55
file: src/shape/custom_shapes.js
6-
description: ''
7-
line: 1594
6+
description: >
7+
<p>Influences the shape of the Bézier curve segment in a custom shape.
8+
9+
By default, this is 3; the other possible parameter is 2. This
10+
11+
results in quadratic Bézier curves.</p>
12+
13+
<p><code>bezierVertex()</code> adds a curved segment to custom shapes. The
14+
Bézier curves
15+
16+
it creates are defined like those made by the
17+
18+
<a href="/reference/p5/bezier/">bezier()</a> function.
19+
<code>bezierVertex()</code> must be
20+
21+
called between the
22+
23+
<a href="/reference/p5/beginShape/">beginShape()</a> and
24+
25+
<a href="/reference/p5/endShape/">endShape()</a> functions. There must be at
26+
least
27+
28+
one call to <a href="/reference/p5/vertex/">bezierVertex()</a>, before
29+
30+
a number of <code>bezierVertex()</code> calls that is a multiple of the
31+
parameter
32+
33+
set by <a href="/reference/p5/bezierOrder/">bezierOrder(...)</a> (default
34+
3).</p>
35+
36+
<p>Each curve of order 3 requires three calls to <code>bezierVertex</code>, so
37+
38+
2 curves would need 7 calls to <code>bezierVertex()</code>:
39+
40+
(1 one initial anchor point, two sets of 3 curves describing the curves)
41+
42+
With <code>bezierOrder(2)</code>, two curves would need 5 calls: 1 + 2 +
43+
2.</p>
44+
45+
<p>Bézier curves can also be drawn in 3D using WebGL mode.</p>
46+
47+
<p>Note: <code>bezierVertex()</code> won’t work when an argument is passed to
48+
49+
<a href="/reference/p5/beginShape/">beginShape()</a>.</p>
50+
line: 1645
851
isConstructor: false
952
itemtype: method
10-
example: []
53+
example:
54+
- |-
55+
<div>
56+
<code>
57+
function setup() {
58+
createCanvas(100, 100);
59+
60+
background(200);
61+
62+
// Style the shape.
63+
noFill();
64+
65+
// Start drawing the shape.
66+
beginShape();
67+
68+
// set the order to 2 for a quadratic Bézier curve
69+
bezierOrder(2);
70+
71+
// Add the first anchor point.
72+
bezierVertex(30, 20);
73+
74+
// Add the Bézier vertex.
75+
bezierVertex(80, 20);
76+
bezierVertex(50, 50);
77+
78+
// Stop drawing the shape.
79+
endShape();
80+
81+
describe('A black curve drawn on a gray square. The curve starts at the top-left corner and ends at the center.');
82+
}
83+
</code>
84+
</div>
1185
class: p5
1286
return:
13-
description: The current bezier order.
87+
description: The current Bézier order.
1488
type: Number
1589
overloads:
16-
- params: []
17-
return:
18-
description: The current bezier order.
19-
type: Number
2090
- params:
2191
- name: order
22-
description: The new order to set.
92+
description: 'The new order to set. Can be either 2 or 3, by default 3'
2393
type: Number
94+
- params: []
95+
return:
96+
description: The current Bézier order.
97+
type: Number
2498
chainable: false
2599
---
26100

0 commit comments

Comments
 (0)