用processing做雨
本帖最后由 苦海 于 2015-1-30 12:12 编辑3分钟代码30分钟注释
几行代码在processing中得到一个下雨的效果。
效果图:
//PROCESSING
//draw rain v 0.1
//LEE
//processing QQ group : 7726768
void setup() {
size(800, 800);//set window size 800 by 800
background(255);//backgound color is white
}
void draw() {//the main function, same as the loop in Arduino code
rain(); // call the rain function;
}
void rain()
{
background(255,100); //use a semitransparent background to renew the window
for(int i =0; i<100; i++)
{
float x =random(800); // get a random raindrop's start loction at X axis
float y =random(800);// get a random raindrop's start loction at Y axis
float l =random(30);// get a random raindrop's length
float deg = random(10); // get a random raindrop direction
float a = random(100); // get a randow raindrop weight
stroke(0,a); // set the weight of raindrop
//draw the rain!
line(x,y,x+(cos((75.0+deg)/180.0*3.14)*(l+40)), y+sin((75.0+deg)/180.0*3.14)*(l+50));
}
}
你这是先做先卖的节奏啊 求看效果图~
求看效果图~+1 求效果图 +! gckulo 发表于 2015-1-30 11:40
求看效果图~
:lol效果图已上 苦海 发表于 2015-1-30 13:09
效果图已上
诶 这个雨效果有点简约嘛 gckulo 发表于 2015-1-30 13:22
诶 这个雨效果有点简约嘛
来个你的想象图, 我试试能不能完成 gckulo 发表于 2015-1-30 13:22
诶 这个雨效果有点简约嘛
静态的效果不好 动态的太大 我放不上去 你来我的位子看吧 苦海 发表于 2015-1-30 15:12
来个你的想象图, 我试试能不能完成
(*/ω\*) 主要看过之前一个学互动艺术的妹子做的那个超漂亮的版本 所以期待值被拉上去了 gckulo 发表于 2015-1-30 15:55
(*/ω\*) 主要看过之前一个学互动艺术的妹子做的那个超漂亮的版本 所以期待值被拉上去了 ...
我是学厨师的汉子。。。
那啥 你来个图 我挑战下 :lol 苦海 发表于 2015-1-30 16:47
我是学厨师的汉子。。。
那啥 你来个图 我挑战下
人家的长这样
gckulo 发表于 2015-1-30 16:55
人家的长这样
我目标也是那样,但是我只有1天时间,,,,:'( 苦海 发表于 2015-1-30 17:04
我目标也是那样,但是我只有1天时间,,,,
哈哈 辛苦啦 这雨滴有点抽象哈 那里看效果图,我怎么没有看到呢... 哈哈哈 看出来是processing了 用随机数做的哦
页:
[1]