I altered the math with the integer value in the “for”
statement. I had the width add 10 and the height add 20, instead of 60 for both
values, which made the boxes in the grid much smaller. I also altered the way
that the screen looked like before the user interacts with it. I duplicated the Spotlight code, but I
changed the location and color of the spotlight to add multiple glowing orbs to
the screen. This makes the screen colorful upon load and more colorful when
interacted with!
MY CODE:
/**
* Mixture Grid
* modified by Alea
from an example by Simon Greenwold.
*
* Display a 2D grid
of boxes with flares of light.
*/
void setup() {
size(900, 600, P3D);
noStroke();
}
void draw() {
defineLights();
background(0);
for (int x = 1; x
<= width; x += 10) {
for (int y = 0; y
<= height; y += 20) {
pushMatrix();
translate(x, y);
rotateY(map(mouseX, 1, width, 0, PI));
rotateX(map(mouseY, 2, height, 0, PI));
box(90);
popMatrix();
}
}
}
void defineLights() {
// Orange point
light on the right
pointLight(250, 90,
0, // Color
200,
-150, 0); // Position
// Blue directional
light from the left
directionalLight(0,
10, 255, // Color
1,
0, 0); // The x-, y-, z-axis direction
// Yellow spotlight
from the front
spotLight(255, 246,
89, // Color
400, 400,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
// green spotlight
from the front
spotLight(89, 255,
199, // Color
0, 40,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
// pink spotlight
from the front
spotLight(232, 89,
255, // Color
700, 700,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
// blue spotlight
from the button
spotLight(44, 46,
178, // Color
200, 700,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
// pink spotlight
from the front
spotLight(232, 89,
255, // Color
700, 500,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
// pink spotlight
from the front
spotLight(232, 89,
255, // Color
700, 700,
200, // Position
0, -0.5,
-0.5, // Direction
PI / 1,
2); // Angle, concentration
}
No comments:
Post a Comment