Haig Armen Educational Archive


Exercise 39

by Haig. Average Reading Time: less than a minute.



// global vars

int _num = 10;    
float _angnoise, _radiusnoise;
float _xnoise, _ynoise;
float _angle = -PI/2;
float _radius = 100;
float _strokeCol = 254;
int _strokeChange = -1;

void setup() {
  size(500, 300);
  smooth(); 
  frameRate(30);
  
  clearBackground();
  
  _angnoise = random(10);
  _radiusnoise = random(10);
  _xnoise = random(10);
  _ynoise = random(10);
}

void clearBackground() {
  background(255);
}

void draw() {
  
  _radiusnoise += 0.005;
  _radius = (noise(_radiusnoise) * 550) +1;
  
  _angnoise += 0.005;
  _angle += (noise(_angnoise) * 6) - 3;
  if (_angle > 360) { _angle -= 360; }
  if (_angle  254) { _strokeChange *= -1; }
  if (_strokeCol < 0) { _strokeChange *= -1; }
  stroke(_strokeCol, 60);
  strokeWeight(1);
  line(x1, y1, x2, y2);
}

void keyPressed() {
  if (keyCode == s) {
    saveFrame("waveclock-####.tif");
  }
}

void mousePressed() {
  clearBackground();
}

No comments on ‘Exercise 39’

Leave a Reply