-
-
Save rors/57c2c1bc36356a4fc7add431348bb919 to your computer and use it in GitHub Desktop.
Homepage image for "Code Toolkit: Python", Fall 2021
This file contains 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
heights = [] | |
moving_heights = [] | |
r = 0 | |
def setup(): | |
size(800,400,P3D) | |
global heights | |
for i in range(0,17): | |
heights.append([]) | |
moving_heights.append([]) | |
for j in range(0,17): | |
heights[i].append(random(-150,110)) | |
moving_heights[i].append(150) | |
smooth() | |
stroke(100) | |
textMode(SHAPE) | |
def draw(): | |
global heights, r | |
background(55) | |
rotateX(-r) | |
rotateY(-r) | |
if millis() > 1500: | |
r += (PI/16-r)*.01 | |
# translate(400,400) | |
for i in range(0,16): | |
for j in range(0,16): | |
#stroke(0) | |
with pushMatrix(): | |
fill(200) | |
translate( i*50,j*50,moving_heights[i][j] ) | |
beginShape() | |
vertex( 0,0,0 ) | |
vertex( 50,0,0 ) | |
vertex( 50,50,0 ) | |
vertex( 0,50,0 ) | |
endShape(CLOSE) | |
fill(255,220,220,50) | |
beginShape() | |
vertex( 0,50,0 ) | |
vertex( 50,50,0 ) | |
vertex( 50,50,moving_heights[i][j+1]-moving_heights[i][j] ) | |
vertex( 0,50,moving_heights[i][j+1]-moving_heights[i][j] ) | |
endShape(CLOSE) | |
fill(200,200,255,100) | |
beginShape() | |
vertex( 50,0,0 ) | |
vertex( 50,50,0 ) | |
vertex( 50,50,moving_heights[i+1][j]-moving_heights[i][j] ) | |
vertex( 50,0,moving_heights[i+1][j]-moving_heights[i][j] ) | |
endShape(CLOSE) | |
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