2023. 4. 24. 19:25ㆍLess Code with ChatGPT/Processing
움직이는 3D 박스 1개 만들기
Code>>
//Set up drawing function
void setup() {
size(600, 600, P3D);
}
//Draw loop
void draw(){
background(100);
translate(width/2, height/2, 0);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
box(100);
}
여러개 움직이는 3D 박스 만들기
Code>>
//Set up drawing function
void setup() {
size(600, 600, P3D);
}
//Draw loop
void draw(){
background(100);
translate(width/2, height/2);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
for (int i = 0; i < 100; i++) {
//Set initial translation x, y and z coordinates for the cube
pushMatrix();
translate(random(-width/2, width/2), random(-height/2, height/2), random(-100, 100));
rotateX(frameCount * 0.02);
rotateY(frameCount * 0.02);
box(random(50, 100));
popMatrix();
}
}
컬러풀한 여러개 움직이는 3D 박스 만들기
Code>>
//Set up drawing function
void setup() {
size(600, 600, P3D);
}
//Draw loop
void draw(){
background(100);
translate(width/2, height/2);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
for (int i = 0; i < 100; i++) {
//Set initial translation x, y and z coordinates for the cube
pushMatrix();
translate(random(-width/2, width/2), random(-height/2, height/2), random(-100, 100));
rotateX(frameCount * 0.02);
rotateY(frameCount * 0.02);
fill(random(255), random(255), random(255));
box(random(50, 100));
popMatrix();
}
}
마우스에 반응하는 컬러풀한 여러개 움직이는 3D 박스 만들기
Code>>
/Set up drawing function
void setup() {
size(600, 600, P3D);
}
//Draw loop
void draw(){
background(100);
translate(width/2, height/2);
rotateX(map(mouseY, 0, height, -PI, PI ));
rotateX(map(mouseX, 0, height, -PI, PI ));
for (int i = 0; i < 100; i++) {
//Set initial translation x, y and z coordinates for the cube
pushMatrix();
translate(random(-width/2, width/2), random(-height/2, height/2), random(-100, 100));
rotateX(frameCount * 0.02);
rotateY(frameCount * 0.02);
fill(random(255), random(255), random(255));
box(random(50, 100));
popMatrix();
}
}
원본 따라하기 영상
'Less Code with ChatGPT > Processing' 카테고리의 다른 글
ChatGPT + Processing 으로 그림따라그리기 (0) | 2023.04.25 |
---|---|
#5. Processing -Variations (0) | 2023.04.25 |
#4. Processing -Variations (0) | 2023.04.24 |
#3. Processing - Interact/Animate (0) | 2023.04.24 |
#2. Processing -Colors (0) | 2023.04.23 |