sevenfives

Processing / colourful circles

May 28th, 2015
183
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float[] angle = new float[20];
  2. float[] time = new float[20];
  3.  
  4. int[] clr = new int [20];
  5. color[] c = new color [3];
  6.  
  7. void setup() {
  8.   size(400, 400, P2D);
  9.   background(#e9eae1);
  10.   noStroke();
  11.   fill(20);
  12.  
  13.   c[0] = color(255, 0, 0);
  14.   c[1] = color(0, 255, 0);
  15.   c[2] = color(0, 0, 255);
  16.  
  17.   for (int i = 0; i < angle.length; i++) {
  18.     angle[i] = random(100);
  19.     time[i] = random(0.01, 0.08);
  20.     clr[i] = c[int(random(3))];
  21.   }
  22. }
  23.  
  24. void draw() {
  25.   blendMode(BLEND);
  26.   //background(#e9eae1);
  27.   fill(#e9eae1, 15);
  28.   rect(0, 0, width, height);
  29.  
  30.   blendMode(SUBTRACT);
  31.   for (int i = 0; i < angle.length; i++) {
  32.     fill(clr[i]);
  33.     ellipse(width/2+sin(angle[i])*80, height/2+cos(angle[i])*80, 10, 10);
  34.     angle[i] = angle[i] + time[i];
  35.   }
  36.  
  37. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×