Chris_M_Thomasson

Rouge Pixel!

Aug 12th, 2017
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. /*
  2. Rouge Pixel For Semi-Circle Wave "Detect?"... ;^)
  3. First try by: Chris M. Thomasson
  4. ____________________________________________________*/
  5.  
  6. float t = 0;
  7. float tinc = .4;
  8. float mr = 128;
  9.  
  10. void setup()
  11. {
  12.   size(800, 800);//canvas
  13.   t=0;
  14.   noFill();
  15.   background(0);
  16.   colorMode(RGB, 255);
  17. }
  18.  
  19.  
  20. void draw()
  21. {
  22.   translate(width/2, height/2);
  23.  
  24.   // sin cos pair.
  25.   float tcos = (cos(t)+floor(sin(t))*2+1);
  26.   float tsin = sin(t);
  27.  
  28.   // projection
  29.   float x = tcos * mr;
  30.   float y = -tsin * mr;
  31.  
  32.   // color
  33.   float a = floor(t * 1234) % 256;
  34.   float b = floor(t * 4520) % 256;
  35.  
  36.   stroke(a, 255, b);//white
  37.   line(x, y, 0, 0);
  38.  
  39.   // detect rouge pixel... Simple! ;^)
  40.   if (tcos > 2)
  41.   {
  42.     println("ROUGE PIXEL AT: (", tcos, ", ", tsin, ")");
  43.     println("noLoop()");
  44.     noLoop(); //term
  45.   }
  46.  
  47.   // bump t, at the end
  48.   t += tinc;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment