void setup(){
size(500,500);
}
void draw(){
if(mousePressed) background(255,0,0);//紅色
else background(0,255,0);//綠色
}
void setup(){
size(500,500);
}
void draw(){
if(mousePressed) line(mouseX,mouseY,pmouseX,pmouseY);
}//如果mouse按下去,就畫線mouse的XY座標到previous mouse XY
快捷鍵:
ctrl+c,ctrl+v
ctrl+Z還原
ctrl+T自動排版
ctrl+M新文件
ctrl+S存檔
ctrl+A全選
void keyPressed(){
if(key=='1')strokeWeight(1);
if(key=='2')strokeWeight(5);
if(key=='3')strokeWeight(10);
}//如果key按下去,看key的值,決定線的粗細
void keyPressed(){
if(key=='1')strokeWeight(1);
if(key=='2')strokeWeight(5);
if(key=='3')strokeWeight(10);
if(key=='4')stroke(255,0,0);
if(key=='5')stroke(255,255,0);
if(key=='6')stroke(0,255,0);
if(key=='7')stroke(0,0,255);
if(key=='8')stroke(255,0,255);
}//如果key按下去,看key的值,決定線的粗細
strokeu顏色
size(600,400);
background(#FFFFA2); //色彩的色碼#RRGGBB
rect(100,100,400,200);
//在100,100的地方,寬度400,長度200的長方形
fill(#FFFFA2);//填充色
ellipse(300,200,100,100);
size(400, 400);
fill(#FFDC0F);
noStroke();//不會有邊緣的筆觸
//ellipse(50,50,100,100);//本來畫圖
arc(50, 50, 100, 100, -1, PI*2-1,PIE);//改畫弧度
//X座標,Y,寬,高,開始,結束,蘋果派的畫法
加上for就可以畫出很多小精靈
沒有留言:
張貼留言