Skip to content

Commit d193e1b

Browse files
authored
Merge pull request #447 from yogitheboss/main
Adds `describe()` function to directional light, saturation, and color variable examples. It makes these examples more accessible to people using a screen reader.
2 parents 622ae95 + f32e706 commit d193e1b

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

content/examples/Basics/Color/ColorVariables/liveSketch.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,9 @@ function runLiveSketch(s) {
4242
s.pop();
4343

4444
s.noLoop();
45+
46+
s.describe(
47+
'There are two groups of squares. The first group contains three squares of varying sizes one above the other. The color of the smallest square is orange, the color of the middle square is gold, and the color of the biggest square is brown. On the right of the first group is the second set, which is similar to the first. The only difference here is the color of the squares; the smallest square is gold, the middle square is brown, and the biggest square is orange.'
48+
);
4549
};
4650
}

content/examples/Basics/Color/Saturation/liveSketch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ function runLiveSketch(s) {
1515
s.createCanvas(640, 360);
1616
s.colorMode(s.HSB, s.width, s.height, 100);
1717
s.noStroke();
18+
s.describe(
19+
'There is a canvas with a series of vertical bars. As the mouse moves over each bar, the saturation of the color changes. The bar is determined by the x-coordinate of the mouse and the saturation of the bar is determined by the y-coordinate of the mouse. As the move mouse up in the bar, the saturation increases. As the mouse moves down in the bar, the saturation decreases.'
20+
);
1821
};
1922

2023
s.draw = () => {

content/examples/Basics/Lights/Directional/Directional.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* scatters in all directions.
99
*/
1010

11+
1112
void setup() {
1213
size(640, 360, P3D);
1314
noStroke();
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
function runLiveSketch(s) {
2-
32
s.setup = () => {
43
s.createCanvas(640, 360, s.WEBGL);
54
s.noStroke();
65
s.fill(204);
6+
s.describe(
7+
'there are two dark spheres side by side, the cursor works like a light source, when mouse moves the direction of light changes and reveals some part of spheres.'
8+
);
79
};
810

911
s.draw = () => {
10-
s.noStroke();
11-
s.background(0);
12+
s.noStroke();
13+
s.background(0);
1214
let dirY = (s.mouseY / s.height - 0.5) * 2;
1315
let dirX = (s.mouseX / s.width - 0.5) * 2;
14-
s.directionalLight(204, 204, 204, -dirX, -dirY, -1);
15-
s.translate(- 100, 0, 0);
16-
s.sphere(80);
17-
s.translate(200, 0, 0);
18-
s.sphere(80);
16+
s.directionalLight(204, 204, 204, -dirX, -dirY, -1);
17+
s.translate(-100, 0, 0);
18+
s.sphere(80);
19+
s.translate(200, 0, 0);
20+
s.sphere(80);
21+
1922
};
2023
}

0 commit comments

Comments
 (0)