- /*
- author: lisper <leyapin@gmail.com> 2015
- desc: 雪绒花
- */
-
- int show_speed = 30;
-
- PImage img;
- PGraphics pg;
-
- void setup () {
- size (600, 600);
- pg = createGraphics(600, 600);
- img = loadImage ("http://a.picphotos.baidu.com/album/s%3D1100%3Bq%3D90/sign=90adc5ebd12a283447a6320a6b85f29b/7c1ed21b0ef41bd55d9a3d0254da81cb38db3d7f.jpg", "jpg");
-
- }
-
- int numble;
- int shape_random = 6;
-
- void draw () {
- numble = mouseX;
- image (img, 0, 0);
-
- pg.beginDraw ();
- pg.ellipseMode(CENTER);
- pg.noStroke ();
- pg.fill (255, 70);
- if (frameCount % show_speed == 0) {
- show_speed = int (random (5, 30));
- int drop_x = int (random (width));
- int drop_y = int (random (height));
- for (int t=1; t<6; t++) {
- pg.beginShape ();
- for (float i = 0; i < 2*PI; i += (2*PI/30)) {
- float x = t*t * cos (i) + random (shape_random)-shape_random/2;
- float y = t*t * sin (i) + random (shape_random)-shape_random/2;
- pg.vertex (x + drop_x, y + drop_y);
- }
- pg.endShape (CLOSE);
- }
- }
- pg.endDraw ();
- pg.filter (BLUR, 1);
- pg.fill (255, 0);
- pg.rect (0-10, 0-10, width+20, height+20);
- image (pg, 0, 0);
- }
复制代码
|