Created
July 8, 2016 21:40
-
-
Save martoo6/005473eb758d03e2e398c9d61f8b5da9 to your computer and use it in GitHub Desktop.
3D Joy Division processing sketch code
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
import peasy.*; | |
PeasyCam cam; | |
ArrayList<Float> arr = new ArrayList<Float>(20); | |
void setup(){ | |
size(600,600, P3D); | |
smooth(8); | |
cam = new PeasyCam(this, 1000); | |
cam.setMinimumDistance(50); | |
cam.setMaximumDistance(1500); | |
background(0); | |
//noFill(); | |
fill(0); | |
stroke(255); | |
} | |
void draw(){ | |
background(0); | |
rotateX(-QUARTER_PI); | |
float t = frameCount*0.05; | |
float hwidth = width >> 1; | |
for(int i=0;i<20;i++){ | |
beginShape(); | |
float c = 150; | |
for(int e=0;e<c;e++){ | |
float x = e*width/c - hwidth; | |
float xx = map(x,- hwidth, hwidth, -5, 5); | |
float phi = x*0.02+t; | |
float n = noise(cos(phi), sin(phi), i); | |
vertex(x, n*f(xx)*200, i*25); | |
} | |
endShape(); | |
} | |
if(t<TWO_PI) saveFrame("####.jpg"); | |
} | |
float f(float x){ | |
if(x>=3 || x<=-3) return 0; | |
return -map((1 + cos(x))/TWO_PI, 0, 0.31, 0, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment