everybody likes flowers
those grow with attention and their redness increases
- //
- int myAttentionValue=0;
- float angle;
- float myAttentionValuePrev=-1000;
- float x=300, y=300;
- float dirx=+1;
- //
- // ---------------------------------------------------------------
- //
- void setup()
- {
- // init
- size(800, 600);
- frameRate(13);
- } // func
- //
- //
- void draw()
- {
- // background(0);
- // float prevX= 300;
- // float prevY= 300;
- if (myAttentionValue != myAttentionValuePrev) {
- strokeWeight(1);
- stroke(255);
- noFill();
- flower (random ( 200, 500 ), random ( 200, 500 ) );
- x+=dirx*myAttentionValue;
- if (x+myAttentionValue>=width-100)
- dirx=-abs(dirx);
- if (x-myAttentionValue<100)
- dirx=abs(dirx);
- x+=dirx;
- }
- //
- //}
- //
- myAttentionValuePrev = myAttentionValue;
- if (frameCount % 2 == 0 ) {
- myAttentionValue++;
- }
- if (myAttentionValue>=100)
- exit();
- println ("myAttentionValue "+ myAttentionValue);
- } // func
- void flower( float x1, float y1 ) {
- // float val = cos(radians(myAttentionValue)) * 12.0;
- float val = myAttentionValue * 0.13;
- for (int a = 0; a < 360; a += 75) {
- float xoff = cos(radians(a)) * val;
- float yoff = sin(radians(a)) * val;
- fill(myAttentionValue+155, 2, 2);
- ellipse(x1 + xoff, y1 + yoff, val, val);
- }
- fill(255);
- ellipse(x1, y1, 2, 2);
- }
- //
- // =====================================================================