@@ -142,18 +142,18 @@ function acceleration(p5, fn){
142
142
* @example
143
143
* <div>
144
144
* <code>
145
+ * let rotationX = 0; // Angle in degrees
146
+ *
145
147
* function setup() {
146
- * createCanvas(100, 100 , WEBGL);
148
+ * createCanvas(200, 200 , WEBGL); // Create 3D canvas
147
149
* }
148
150
*
149
151
* function draw() {
150
- * background(200);
151
- * //rotateZ(radians(rotationZ));
152
- * rotateX(radians(rotationX));
153
- * //rotateY(radians(rotationY));
154
- * box(200, 200, 200);
155
- * describe(`red horizontal line right, green vertical line bottom.
156
- * black background.`);
152
+ * background(220); // Set light gray background
153
+ * rotateX(radians(rotationX)); // Rotate around X-axis
154
+ * normalMaterial(); // Apply simple shaded material
155
+ * box(60); // Draw 3D cube (60 units wide)
156
+ * rotationX = (rotationX + 2) % 360; // Increment rotation (2° per frame)
157
157
* }
158
158
* </code>
159
159
* </div>
@@ -175,18 +175,18 @@ function acceleration(p5, fn){
175
175
* @example
176
176
* <div>
177
177
* <code>
178
+ * let rotationY = 0; // Angle in degrees
179
+ *
178
180
* function setup() {
179
- * createCanvas(100, 100 , WEBGL);
181
+ * createCanvas(200, 200 , WEBGL); // Create 3D canvas
180
182
* }
181
183
*
182
184
* function draw() {
183
- * background(200);
184
- * //rotateZ(radians(rotationZ));
185
- * //rotateX(radians(rotationX));
186
- * rotateY(radians(rotationY));
187
- * box(200, 200, 200);
188
- * describe(`red horizontal line right, green vertical line bottom.
189
- * black background.`);
185
+ * background(220); // Set light gray background
186
+ * rotateY(radians(rotationY)); // Rotate around Y-axis (vertical)
187
+ * normalMaterial(); // Apply simple shaded material
188
+ * box(60); // Draw 3D cube (60 units wide)
189
+ * rotationY = (rotationY + 2) % 360; // Increment rotation (2° per frame)
190
190
* }
191
191
* </code>
192
192
* </div>
@@ -209,18 +209,18 @@ function acceleration(p5, fn){
209
209
* @example
210
210
* <div>
211
211
* <code>
212
+ * let rotationZ = 0; // Angle in degrees
213
+ *
212
214
* function setup() {
213
- * createCanvas(100, 100 , WEBGL);
215
+ * createCanvas(200, 200 , WEBGL); // Create 3D canvas
214
216
* }
215
217
*
216
218
* function draw() {
217
- * background(200);
218
- * rotateZ(radians(rotationZ));
219
- * //rotateX(radians(rotationX));
220
- * //rotateY(radians(rotationY));
221
- * box(200, 200, 200);
222
- * describe(`red horizontal line right, green vertical line bottom.
223
- * black background.`);
219
+ * background(220);
220
+ * rotateZ(radians(rotationZ)); // Rotate around Z-axis
221
+ * normalMaterial(); // Apply simple shaded material
222
+ * box(60); // Draw 3D cube
223
+ * rotationZ = (rotationZ + 2) % 360; // Increment rotation angle
224
224
* }
225
225
* </code>
226
226
* </div>
0 commit comments