Skip to content

Commit 8a8fd3a

Browse files
committed
added ellipsoid to example. also added describe().
1 parent c5d07a9 commit 8a8fd3a

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,74 @@
11
/*
22
* @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.
55
*/
6+
67
function setup() {
78
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+
);
813
}
914

1015
function draw() {
1116
background(250);
1217

13-
translate(-240, -100, 0);
1418
normalMaterial();
1519
push();
20+
translate(-240, -100, 0);
1621
rotateZ(frameCount * 0.01);
1722
rotateX(frameCount * 0.01);
1823
rotateY(frameCount * 0.01);
1924
plane(70);
2025
pop();
2126

22-
translate(240, 0, 0);
2327
push();
28+
translate(0, -100, 0);
2429
rotateZ(frameCount * 0.01);
2530
rotateX(frameCount * 0.01);
2631
rotateY(frameCount * 0.01);
2732
box(70, 70, 70);
2833
pop();
2934

30-
translate(240, 0, 0);
3135
push();
36+
translate(240, -100, 0);
3237
rotateZ(frameCount * 0.01);
3338
rotateX(frameCount * 0.01);
3439
rotateY(frameCount * 0.01);
3540
cylinder(70, 70);
3641
pop();
3742

38-
translate(-240 * 2, 200, 0);
3943
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);
4053
rotateZ(frameCount * 0.01);
4154
rotateX(frameCount * 0.01);
4255
rotateY(frameCount * 0.01);
43-
cone(70, 70);
56+
torus(50, 20);
4457
pop();
4558

46-
translate(240, 0, 0);
4759
push();
60+
translate(100, 100, 0);
4861
rotateZ(frameCount * 0.01);
4962
rotateX(frameCount * 0.01);
5063
rotateY(frameCount * 0.01);
51-
torus(70, 20);
64+
sphere(50);
5265
pop();
5366

54-
translate(240, 0, 0);
5567
push();
68+
translate(275, 100, 0);
5669
rotateZ(frameCount * 0.01);
5770
rotateX(frameCount * 0.01);
5871
rotateY(frameCount * 0.01);
59-
sphere(70);
72+
ellipsoid(30, 40, 40);
6073
pop();
6174
}

0 commit comments

Comments
 (0)