绘制图案代码:
class DrawMap{
DrawMap(){
}
void draw_Round(){
background(200, 140, 25);
smooth();
noStroke();
for(int y = 0; y <= height; y+=40){
for(int x = 0; x <= width; x+=40){
fill(0, 125, 100);
ellipse(x, y, 40, 40);
}
}
}
void draw_Needle_Line(){
background(200, 140, 25);
smooth();
fill(102);
stroke(102);
for(int y = 20; y <= height-20; y+=10){
for(int x = 20; x <= width-20; x+=10){
ellipse(x, y, 4, 4);
line(x, y, width/2, height/2);
}
}
}
void draw_Net_Point(){
background(0);
smooth();
fill(0, 255, 255);
for(int y = 32; y <= height; y += 8){
for(int x = 32; x <= width; x += 15){
ellipse(x+y, y, 16-y/10.0, 16-y/10.0);
}
}
}
};
DrawMap map;
void setup(){
size(480, 120);
background(0);
}
void draw(){
map = new DrawMap();
map.draw_Round();
//map.draw_Needle_Line();
//map.draw_Net_Point();
}
运行结果:
————————————————————————————————————————
————————————————————————————————————————