class's practice:
windsize
backgroundrect
ellipsestrokeline
else way
size(600,400);//window size
background(10,40,52);//backgroune clolr
//draw rectangle1
fill(16,60,77);//paint
rect(0,300,600,20);//light blue
//draw rectangle2
fill(10,40,58);//paint
rect(0,320,600,20);//blue
//draw rectangle3
fill(5,20,26);//paint
rect(0,340,600,60);//heavy blue
//draw circle
fill(255,255,255);//white
ellipse(500,100,50,50);
//draw little circle ,use stroke
stroke(255,242,0);
strokeWeight(4);//thickness
point(200,100);
point(400,50);
point(200,10);
point(10,30);
point(250,25);
point(150,80);
point(100,180);
point(350,100);
//draw line
stroke(255,127,39);//orange
line(100,200,300,200);
background(10,40,52);//backgroune clolr
//draw rectangle1
fill(16,60,77);//paint
rect(0,300,600,20);//light blue
//draw rectangle2
fill(10,40,58);//paint
rect(0,320,600,20);//blue
//draw rectangle3
fill(5,20,26);//paint
rect(0,340,600,60);//heavy blue
//draw circle
fill(255,255,255);//white
ellipse(500,100,50,50);
//draw little circle ,use stroke
stroke(255,242,0);
strokeWeight(4);//thickness
point(200,100);
point(400,50);
point(200,10);
point(10,30);
point(250,25);
point(150,80);
point(100,180);
point(350,100);
//draw line
stroke(255,127,39);//orange
line(100,200,300,200);
HW's practice:
loadImage:
pointillize:
setup,drawimage
Mode
noStroke
color
fill
ellipse
setup,drawimage
Mode
noStroke
color
fill
ellipse
HW's code:
PImage photo;
int smallP=10, largeP=20;
//setup window size same as image
void setup() {
size(600, 411);//image's size
photo = loadImage("cars.jpg");//load image's file
imageMode(CENTER);//image's mode
noStroke();//without black out line
background(0, 0, 0);//background's color is black
}
//show the image
void draw() {
//returns float
float pointillize=map(mouseX,0,width,smallP,largeP);
//image(image's variable name, leftupP x, leftupP y)
int x=int(random(photo.width));//random x from img's width
int y=int(random(photo.height));//random y from img's height
color c =photo.get(x,y);//color from img
fill(c,200);//fill(rgb,alpha);
ellipse(x, y, pointillize, pointillize);
}





沒有留言:
張貼留言