/code-toolkit-2024-welcome.pde Secret
Created
January 24, 2024 15:51
Homepage image for "Code Toolkit: Python", Spring 2024 (written using Java)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Rory Solomon | |
* Code Toolkit: Python | |
* Spring 2024 | |
* Code as a Liberal Art, Eugene Lang College, The New School | |
*/ | |
int[][] heights = new int[18][18]; | |
int[][] moving_heights = new int[18][18]; | |
float r = 0; | |
int squareSize = 40; | |
void setup() { | |
size(800, 400, P3D); | |
for (int i = 0; i < 18; i++) { | |
for (int j = 0; j < 18; j++) { | |
heights[i][j] = int(random(260)) - 150; | |
moving_heights[i][j] = 150; | |
} | |
} | |
smooth(); | |
stroke(100); | |
textMode(SHAPE); | |
} | |
void draw() { | |
background(#3F7373); | |
rotateX(PI/4); | |
rotateZ(-PI/4); | |
translate(-50,0,0); | |
for (int i = 0; i < 17; i++) { | |
for (int j = 0; j < 17; j++) { | |
stroke(#732B1A); | |
pushMatrix(); | |
fill(#BF754B); | |
translate( i*squareSize, j*squareSize, moving_heights[i][j] ); | |
beginShape(); | |
vertex( 0, 0, 0 ); | |
vertex( squareSize, 0, 0 ); | |
vertex( squareSize, squareSize, 0 ); | |
vertex( 0, squareSize, 0 ); | |
endShape(CLOSE); | |
fill(225, 200, 255, 50); | |
beginShape(); | |
vertex( 0, squareSize, 0 ); | |
vertex( squareSize, squareSize, 0 ); | |
vertex( squareSize, squareSize, moving_heights[i][j+1]-moving_heights[i][j] ); | |
vertex( 0, squareSize, moving_heights[i][j+1]-moving_heights[i][j] ); | |
endShape(CLOSE); | |
fill(200, 200, 255, 100); | |
beginShape(); | |
vertex( squareSize, 0, 0 ); | |
vertex( squareSize, squareSize, 0 ); | |
vertex( squareSize, squareSize, moving_heights[i+1][j]-moving_heights[i][j] ); | |
vertex( squareSize, 0, moving_heights[i+1][j]-moving_heights[i][j] ); | |
endShape(CLOSE); | |
popMatrix(); | |
moving_heights[i][j] += (heights[i][j] - moving_heights[i][j])*.005; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment