User Tools

Site Tools


cs276:rotatecorner
/*
 *   RotateCorner
 *
 *   Illustrates transformations using translate() and rotate() by
 *   creating a semi-spiral shape out of rectangles rotated about a 
 *   common corner point, set with the translate function.
 *
 *   Created 24 Oct 2007 by spc
 */
 
float angle = PI/12;
 
void setup() {
  size(300, 300);
  background(204);
  frameRate(15);
}
 
void draw() {
  translate(130, 100);
  rotate(angle);
  fill(46, 68, 255);
  rect(0, 0, 80, 40);
  angle += PI/12;
  if (frameCount > 16) 
    noLoop();
}
cs276/rotatecorner.txt · Last modified: 2007/10/26 16:10 by scarl