Skip to content

Commit e4c3a9e

Browse files
committed
Merge branch 'dev-2.0' into compute-shaders
2 parents d815160 + 24a08dc commit e4c3a9e

File tree

11 files changed

+61
-5
lines changed

11 files changed

+61
-5
lines changed

contributor_docs/contributing_to_the_p5js_reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ In some editors, such as vs code, you can hover over a function or variable to s
11901190
11911191
### Previewing your work on the website, locally
11921192
1193-
At some point you will want to preview how your changes will look on the website. This involves run the website locally and having it import your p5.js code from a branch of your repo.
1193+
At some point you will want to preview how your changes will look on the website. This involves running the website locally and having it import your p5.js code from a branch of your repo.
11941194
11951195
Steps:
11961196

contributor_docs/documentation_style_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ let magicWord = 'Please';
234234

235235
## Accessible Canvas Labels
236236

237-
- Use `describe()` to in p5.js example code, to add labels to your canvas so that it’s readable for screen readers.
237+
- Use `describe()` in p5.js example code to add labels to your canvas so that it’s readable for screen readers.
238238

239239
> Why? It makes examples accessible to screen readers, and models how to write good canvas labels.
240240

contributor_docs/project_wrapups/katiejliu_gsoc_2021.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#### Mentors: Rachel Lim and Claire Kearney-Volpe
44

55
### Overview
6-
For my Google Summer of Code project, I added alt text to the visual elements of the p5.js website, specfically to all of the examples. With the help of my mentors Rachel and Claire, I was able to improve the accessibility of the p5.js website for users with visually impairment.
6+
For my Google Summer of Code project, I added alt text to the visual elements of the p5.js website, specifically to all of the examples. With the help of my mentors Rachel and Claire, I was able to improve the accessibility of the p5.js website for users with visually impairment.
77

88
### Process
99
To begin, I did a lot of research on best alt text practices. I read about web accessibility through sources such as articles from WebAIM and the Web Content Accessibility Guidelines from W3C. I also familiarized myself with navigating and using the built-in screen reader on my Mac.

src/color/setting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ function setting(p5, fn){
509509
*
510510
* describe('A canvas with a transparent green background.');
511511
* }
512-
* <
512+
*
513513
* @example
514514
* function setup() {
515515
* createCanvas(100, 100);

src/strands/strands_api.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ export function initGlobalStrandsAPI(p5, fn, strandsContext) {
284284
}
285285
}
286286

287+
// Alias lerp to GLSL mix in strands context
288+
const originalLerp = fn.lerp;
289+
augmentFn(fn, p5, 'lerp', function (...args) {
290+
if (strandsContext.active) {
291+
return fn.mix(...args);
292+
} else {
293+
return originalLerp.apply(this, args);
294+
}
295+
});
296+
287297
augmentFn(fn, p5, 'getTexture', function (...rawArgs) {
288298
if (strandsContext.active) {
289299
const { id, dimension } = strandsContext.backend.createGetTextureCall(strandsContext, rawArgs);

src/webgl/p5.Geometry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class Geometry {
330330
* let saveBtn;
331331
* function setup() {
332332
* createCanvas(200, 200, WEBGL);
333-
* myModel = buildGeometry(function()) {
333+
* myModel = buildGeometry(function() {
334334
* for (let i = 0; i < 5; i++) {
335335
* push();
336336
* translate(

test/unit/visual/cases/webgl.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,46 @@ visualSuite('WebGL', function() {
10671067
screenshot();
10681068
});
10691069

1070+
visualTest('lerp maps to mix in strands context', (p5, screenshot) => {
1071+
p5.createCanvas(50, 50, p5.WEBGL);
1072+
// lerp should behave identically to mix inside strands
1073+
const shader = p5.baseColorShader().modify(() => {
1074+
p5.getFinalColor((color) => {
1075+
color = p5.lerp(
1076+
[1, 0, 0, 1],
1077+
[0, 0, 1, 1],
1078+
0.5
1079+
);
1080+
return color;
1081+
});
1082+
}, { p5 });
1083+
p5.background(0);
1084+
p5.shader(shader);
1085+
p5.noStroke();
1086+
p5.plane(50, 50);
1087+
screenshot();
1088+
});
1089+
1090+
visualTest('mix produces same result as lerp in strands', (p5, screenshot) => {
1091+
p5.createCanvas(50, 50, p5.WEBGL);
1092+
// mix directly, should produce identical output to lerp test above
1093+
const shader = p5.baseColorShader().modify(() => {
1094+
p5.getFinalColor((color) => {
1095+
color = p5.mix(
1096+
[1, 0, 0, 1],
1097+
[0, 0, 1, 1],
1098+
0.5
1099+
);
1100+
return color;
1101+
});
1102+
}, { p5 });
1103+
p5.background(0);
1104+
p5.shader(shader);
1105+
p5.noStroke();
1106+
p5.plane(50, 50);
1107+
screenshot();
1108+
});
1109+
10701110
visualSuite('auto-return for shader hooks', () => {
10711111
visualTest('auto-returns input struct when return is omitted', (p5, screenshot) => {
10721112
p5.createCanvas(50, 50, p5.WEBGL);
236 Bytes
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}
236 Bytes
Loading

0 commit comments

Comments
 (0)