Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Visualise Real time long CSV datatype

$
0
0


everybody likes flowers

those grow with attention and their redness increases



  1. //
  2. int myAttentionValue=0;
  3. float angle;
  4. float myAttentionValuePrev=-1000;
  5. float x=300, y=300;
  6. float dirx=+1;
  7. //
  8. // ---------------------------------------------------------------
  9. //
  10. void setup()
  11. {
  12.   // init
  13.   size(800, 600);
  14.   frameRate(13);
  15. } // func
  16. //
  17. //
  18. void draw()
  19. {
  20.   //  background(0);
  21.   //  float prevX= 300;
  22.   //  float prevY= 300;
  23.   if (myAttentionValue != myAttentionValuePrev) {
  24.     strokeWeight(1);
  25.     stroke(255);
  26.     noFill();
  27.     flower  (random ( 200, 500 ), random ( 200, 500 ) );
  28.     x+=dirx*myAttentionValue;
  29.     if (x+myAttentionValue>=width-100)
  30.       dirx=-abs(dirx);
  31.     if (x-myAttentionValue<100)
  32.       dirx=abs(dirx);
  33.     x+=dirx;
  34.   }
  35.   //
  36.   //}
  37.   //
  38.   myAttentionValuePrev = myAttentionValue;
  39.   if (frameCount % 2 == 0 ) {
  40.     myAttentionValue++;
  41.   }
  42.   if (myAttentionValue>=100)
  43.     exit();
  44.   println ("myAttentionValue  "+ myAttentionValue);
  45. } // func
  46. void flower( float x1, float y1 ) {
  47.   // float val = cos(radians(myAttentionValue)) * 12.0;
  48.   float val = myAttentionValue * 0.13;
  49.   for (int a = 0; a < 360; a += 75) {
  50.     float xoff = cos(radians(a)) * val;
  51.     float yoff = sin(radians(a)) * val;
  52.     fill(myAttentionValue+155, 2, 2);
  53.     ellipse(x1 + xoff, y1 + yoff, val, val);
  54.   }
  55.   fill(255);
  56.   ellipse(x1, y1, 2, 2);
  57. }
  58. //
  59. // =====================================================================


Viewing all articles
Browse latest Browse all 1768

Trending Articles