|
1 | 1 | /*
|
2 | 2 | * @name Geometries
|
3 |
| - * @arialabel Six 3D shapes in neon gradient rotating on a white background. Shapes include cube, cylinder, ring, pyramid, sphere, and a plane. |
4 |
| - * @description There are six 3D primitives in p5 now. |
| 3 | + * @arialabel Seven 3D shapes in neon gradient rotating on a white background. Shapes include cube, cylinder, ring, pyramid, sphere, plane, and ellipsoid. |
| 4 | + * @description There are seven 3D primitives in p5 now. |
5 | 5 | */
|
| 6 | + |
6 | 7 | function setup() {
|
7 | 8 | createCanvas(710, 400, WEBGL);
|
| 9 | + |
| 10 | + describe( |
| 11 | + 'a 3d example containing seven primitive objects, a plane, box, cylinder, cone, torus, sphere, and ellipsoid.' |
| 12 | + ); |
8 | 13 | }
|
9 | 14 |
|
10 | 15 | function draw() {
|
11 | 16 | background(250);
|
12 | 17 |
|
13 |
| - translate(-240, -100, 0); |
14 | 18 | normalMaterial();
|
15 | 19 | push();
|
| 20 | + translate(-240, -100, 0); |
16 | 21 | rotateZ(frameCount * 0.01);
|
17 | 22 | rotateX(frameCount * 0.01);
|
18 | 23 | rotateY(frameCount * 0.01);
|
19 | 24 | plane(70);
|
20 | 25 | pop();
|
21 | 26 |
|
22 |
| - translate(240, 0, 0); |
23 | 27 | push();
|
| 28 | + translate(0, -100, 0); |
24 | 29 | rotateZ(frameCount * 0.01);
|
25 | 30 | rotateX(frameCount * 0.01);
|
26 | 31 | rotateY(frameCount * 0.01);
|
27 | 32 | box(70, 70, 70);
|
28 | 33 | pop();
|
29 | 34 |
|
30 |
| - translate(240, 0, 0); |
31 | 35 | push();
|
| 36 | + translate(240, -100, 0); |
32 | 37 | rotateZ(frameCount * 0.01);
|
33 | 38 | rotateX(frameCount * 0.01);
|
34 | 39 | rotateY(frameCount * 0.01);
|
35 | 40 | cylinder(70, 70);
|
36 | 41 | pop();
|
37 | 42 |
|
38 |
| - translate(-240 * 2, 200, 0); |
39 | 43 | push();
|
| 44 | + translate(-250, 100, 0); |
| 45 | + rotateZ(frameCount * 0.01); |
| 46 | + rotateX(frameCount * 0.01); |
| 47 | + rotateY(frameCount * 0.01); |
| 48 | + cone(50, 70); |
| 49 | + pop(); |
| 50 | + |
| 51 | + push(); |
| 52 | + translate(-75, 100, 0); |
40 | 53 | rotateZ(frameCount * 0.01);
|
41 | 54 | rotateX(frameCount * 0.01);
|
42 | 55 | rotateY(frameCount * 0.01);
|
43 |
| - cone(70, 70); |
| 56 | + torus(50, 20); |
44 | 57 | pop();
|
45 | 58 |
|
46 |
| - translate(240, 0, 0); |
47 | 59 | push();
|
| 60 | + translate(100, 100, 0); |
48 | 61 | rotateZ(frameCount * 0.01);
|
49 | 62 | rotateX(frameCount * 0.01);
|
50 | 63 | rotateY(frameCount * 0.01);
|
51 |
| - torus(70, 20); |
| 64 | + sphere(50); |
52 | 65 | pop();
|
53 | 66 |
|
54 |
| - translate(240, 0, 0); |
55 | 67 | push();
|
| 68 | + translate(275, 100, 0); |
56 | 69 | rotateZ(frameCount * 0.01);
|
57 | 70 | rotateX(frameCount * 0.01);
|
58 | 71 | rotateY(frameCount * 0.01);
|
59 |
| - sphere(70); |
| 72 | + ellipsoid(30, 40, 40); |
60 | 73 | pop();
|
61 | 74 | }
|
0 commit comments