您的位置:首页 > 运维架构 > Linux

(三)利用processing绘制简单规律图像

2016-02-15 08:31 405 查看
绘制图案代码:

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();
}
运行结果:



————————————————————————————————————————



————————————————————————————————————————

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  processing linux