[프로세싱] 랜덤한 위치에 그려지는 원을 선으로 연결하기
함수
line() // line(선의 첫번째 점 x좌표, y좌료, 선의 두번째 점 x좌표, y좌표)
stroke() // 선 색깔
fill()
strokeWeight() // 선의 굵기 (별도로 지정하지 않을 경우 기본값 1)
int x1,y1,x2,y2;
int count=0;
void setup(){
size(720, 480);
background(10,10,100);
frameRate(10);
x2=0;
y2=0;
}
void draw() {
noStroke();
fill(10,10,50,5);
rect(0,0,width,height);
x1=int(random(width));
y1=int(random(height));
fill(random(150,255),random(150,255),random(150,255));
ellipse(x1,y1,10,10);
stroke(255);
line(x1,y1,x2,y2);
x2=x1;
y2=y1;
println(x1+":"+y1);
}
void keyPressed(){
if(key=='s') {
saveFrame("image"+nf(count,3)+".jpg");
count+=1;
}
}
'미디어아트.아트코딩 > 프로세싱 processing' 카테고리의 다른 글
[프로세싱] 랜덤하게 숫자 출력하기 + keyPressed() (0) | 2025.02.04 |
---|---|
[프로세싱] 랜덤하게 숫자 출력하기 + if/else if (0) | 2025.02.04 |
[프로세싱] 랜덤하게 숫자 출력하기 + 폰트 지정 (0) | 2025.02.04 |
[프로세싱] 시스템 변수 (0) | 2025.02.04 |
[프로세싱] 랜덤하게 숫자 출력하기 (0) | 2025.02.04 |