Created
August 19, 2018 09:37
-
-
Save tai-fukaya/b4f392a2bc303bc5a31b8e8f308c0df4 to your computer and use it in GitHub Desktop.
Processingのbezierと3D上であそびたかった
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
void setup() { | |
size(640, 640, P3D); | |
// noSmooth(); | |
} | |
void draw() { | |
background(0); | |
text(frameRate, 20,20); | |
lights(); | |
pushStyle(); | |
pushMatrix(); | |
translate(width/2, height/2, -500); | |
rotateY(PI*mouseX/width); | |
fill(255, 150, 255); | |
noStroke(); | |
sphere(200); | |
noFill(); | |
stroke(255, 150, 255); | |
float radius = 200; | |
float outerRadius = 220; | |
stroke(255, 100, 255); | |
for(int s = 0; s <= 180; s += 10){ | |
float radianS = radians(s); | |
float z = cos(radianS); | |
for(int t = 0; t < 360; t += 10){ | |
float radianT = radians(t); | |
float x = sin(radianS) * cos(radianT); | |
float y = sin(radianS) * sin(radianT); | |
float or = outerRadius + 30*noise((frameCount+s+t)*0.02); | |
bezier( | |
x*radius, y*radius, z*radius, | |
x*radius, y*radius, z*radius, | |
x*or, y*or, z*or, | |
x*or, y*or+((y+1)/2)*300, z*or | |
); | |
} | |
} | |
popMatrix(); | |
popStyle(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment