int m = millis(),n=1;
void setup()
{
size(500,400);
background(255,255,255);
fill(255,0,0);//紅色方格
noStroke();
rect(0,0,50,50);
fill(0,0,0);//黑色方格
rect(0,50,50,50);
fill(0,0,255);//藍色方格
rect(0,100,50,50);
fill(255,255,0);//黃色方格
rect(0,150,50,50);
fill(0,255,0);//綠色方格
rect(0,200,50,50);
stroke(0,0,0);
fill(255,255,255);//筆觸
rect(450,0,50,50);
fill(255,255,255);
ellipse(475, 25, n,n);//筆觸
fill(255);
rect(450,50,50,50);
ellipse(475, 75, n, n);//筆觸
//rect(450,100,50,50);
//ellipse(475, 125, 10,10);//筆觸
//rect(0,250,50,50);
//stroke(255,0,0);
fill(255,255,255);//筆觸
rect(450,100,50,50);
fill(255,255,255);
rect(450,150,50,50);
fill(255,255,255);//筆觸
rect(450,200,50,50);
strokeWeight(1);
}
void draw()
{
if(mousePressed && mouseX>450 && mouseX<500&&mouseY>150&&mouseY<200) save("aaaa.jpg");
else if(mousePressed && mouseX>500 && mouseX<550&&mouseY>200&&mouseY<250){
PImage file = loadImage("aaaa.png");
image(file, 0,0,500,400);
}
if(n<=2)n=2;
if(n>=20)n=20;
if(mouseX>450 && mouseX<500 && mouseY>0 && mouseY<50 && mousePressed)
{
n++;
strokeWeight(1);
fill(255,255,255);//筆觸
rect(450,100,50,50);
fill(0,0,0);
ellipse(475, 125, n,n);//筆觸
strokeWeight(n);
}
else if(mouseX>450 && mouseX<500 && mouseY>50 && mouseY<100 && mousePressed)
{
n--;
strokeWeight(1);
fill(255,255,255);//筆觸
rect(450,100,50,50);
fill(255,255,255);
ellipse(475, 125, n,n);//筆觸
strokeWeight(n);
}
else if(mouseX>450 && mouseX<500 && mouseY>100 && mouseY<150 && mousePressed)
{
n=10;
}
else if(mouseX < 50 && mouseY<50 && mousePressed)
{
stroke(255,0,0);//紅色
}
else if(mouseX < 50 && mouseY<100 && mousePressed)
{
stroke(0,0,0);//黑色
}
else if(mouseX < 50 && mouseY<150 && mousePressed)
{
stroke(0,0,255);//藍色
}
else if(mouseX < 50 && mouseY<200 && mousePressed)
{
stroke(255,255,0);//黃色
}
else if(mouseX < 50 && mouseY<250 && mousePressed)
{
stroke(0,255,0);//綠色
}
else if(mouseX < 50 && mouseY<300 && mousePressed)
{
stroke(255,255,255);//白色
}
else if(mousePressed)
{
m=second();
strokeWeight(n);
line(mouseX,mouseY,pmouseX,pmouseY);
}
}
85
回覆刪除