A coding mini-study used to explore the possibilities of processing.
/**
* Lights 2
* by Simon Greenwold.
*
* Display a box with three different kinds of lights.
*/
void setup()
{
size(1080, 640, P3D);
noStroke();
}
void draw()
{
background(255, 255, 255);
translate(width / 4, height / 2);
// Orange point light on the right
pointLight(0, 0, 255, // Color
200, -150, 0); // Position
// Blue directional light from the left
directionalLight(0, 255, 0, // Color
1, 0, 0); // The x-, y-, z-axis direction
// Yellow spotlight from the front
spotLight(255, 0, 0, // Color
0, 40, 200, // Position
0, -0.5, -0.5, // Direction
PI / 2, 2); // Angle, concentration
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 8, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 4, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 2, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 2, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 1, height / 8);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 2, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 2, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
// Position of following box
translate(width / 1, height / 8);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 4, height / 2);
// Orange point light on the right
pointLight(0, 0, 255, // Color
200, -150, 0); // Position
// Blue directional light from the left
directionalLight(0, 255, 0, // Color
1, 0, 0); // The x-, y-, z-axis direction
// Yellow spotlight from the front
spotLight(255, 0, 0, // Color
0, 40, 200, // Position
0, -0.5, -0.5, // Direction
PI / 2, 2); // Angle, concentration
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 8, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 4, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 2, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 2, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 1, height / 8);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 2, height / 4);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 2, height / 1);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
translate(width / 1, height / 8);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(80);
}
No comments:
Post a Comment