import peasy.*;
int val;
float rot;
float zoom = 1;
PeasyCam cam;
void setup(){
size(600,400, P3D); //3D canvas?
cam = new PeasyCam(this, 500); //두번째 인자 높이면 뷰포트 줌아웃?
cam.setMinimumDistance(50); //줌 인아웃에 제한을 둘 수 있다.
cam.setMaximumDistance(500);
PFont font = createFont("NanumGothic", 12);
textFont(font);
}
void draw(){
background(0);
//fill(120);
lights();
smooth();
//translate(val, val);
//sphere(200);
rotateY(rot);
rotateX(rot);
if (rot < 360) {
rot += 0.01;
} else {
rot = 0;
}
float r = 200;
int total = 50;
for (int i =0; i < total; i++){
float lon = map(i, 0, total, -PI, PI);
for (int j =0; j < total; j++) {
float lat = map(j, 0, total, -HALF_PI, HALF_PI);
float x = r * sin(lon) * cos(lat);
float y = r * sin(lon) * sin(lat);
float z = r * cos(lon);
stroke(val,55,val);
strokeWeight(3);
point(x,y,z);
}
}
//text
fill(255,180,0);
textSize(44);
text("cosmos", -70, 20);
delay(100);
}