Week 13

by Yulong Guo
  • Show Sketch
/** @peep sketchcode */
//A good sketch sourced from http://studio.sketchpad.cc/sp/pad/view/ro.9NbamtrOCmqlQ/rev.519
 
float a = 0;
float b = 0;
float c = 0;
float d = 0;
float max = 50;
 
void setup() {
  smooth();
  background(255);
  colorMode(HSB, max);
  size(600,600);
  strokeWeight(10);
  frameRate(100);
}
 
void draw() {
  noStroke();
  fill(max, 3);
  rect(0, 0, width, height);
 
  stroke(d, 100, 100);
  float x = map(cos(a), -2, 2, 0, width);
  float y = map(sin(a), -2, 2, 0, height);
  float diam = map(cos(b), -1, 3, 0, width);
  ellipse(x, y, diam, diam);
 
  a = a + 0.01;
  b = b + 0.1;
  c = c + 0.01;
  d++;
  if(d >= max) {
    d = 0;
  }
}
 
void keyPressed() {
  if(key == 'p') {
    noLoop();
  }
 
  if(key == 'r') {
    loop();
  }
}

Comments

Nobody has said anything yet.