2023. 4. 25. 14:26ㆍLess Code with ChatGPT/Processing
Code>>
//Set up drawing function
void setup() {
size(1000, 700, P3D);
background(200,0,0);
lights();
}
//Draw loop
void draw(){
stroke(0);//중심큐브
fill(227,206,240);
translate(width/2, height/2, 0);
rotateX(frameCount * 0.02);
rotateY(frameCount * 0.02);
box(200);
stroke(0);//움직이는 100 사이즈 큐브
fill(100,200,255);
translate(width/10, height/10, 10);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.02);
box(100);
noFill();//움직이는 구형
stroke(0);
pushMatrix();
translate(360,height*0.5,360);
sphere(150);
popMatrix();
}
Run Code>>
Variation Code>>
//Set up drawing function
void setup() {
size(1000, 700, P3D);
background(200,0,0);
lights();
}
void draw() {
if (mousePressed) {
stroke(0);//중심큐브
fill(227,206,240);
translate(width/2, height/2, 0);
rotateX(frameCount * 0.02);
rotateY(frameCount * 0.02);
box(200);
stroke(0);//움직이는 100 사이즈 큐브
fill(100,200,255);
translate(width/10, height/10, 10);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.02);
box(100);
noFill();//움직이는 구형
stroke(0);
pushMatrix();
translate(360,height*0.5,360);
sphere(150);
popMatrix();
}
}
Run Code>>
마우스 클릭에 따라 그림이 작동하게 할 수 있다.
프로세싱에서 실행해보기
'Less Code with ChatGPT > Processing' 카테고리의 다른 글
ChatGPT + Processing 으로 그림따라그리기 (0) | 2023.04.25 |
---|---|
ChatGPT + Processing 으로 3D 그림 만들기 Interactive Digital Art (0) | 2023.04.24 |
#4. Processing -Variations (0) | 2023.04.24 |
#3. Processing - Interact/Animate (0) | 2023.04.24 |
#2. Processing -Colors (0) | 2023.04.23 |