User Tools

Site Tools


cs276:spc.lab5

CSci 276 Lab #5

The purpose of this lab is to practice transformations.

Lab Exercises

Run these sketches from the text and post a screen shot from each:

//Sketch 14-22
void setup() {
   size(100, 100);
   noStroke();
}
 
void draw() {
  background(126);
  translate(mouseX, mouseY);
  ellipse(0, 0, 33, 33);
}
//Sketch 14-23
void setup() {
   size(100, 100);
   strokeWeight(8);
}
 
void draw() {
  background(204);
  float angle = map(mouseX, 0, width, 0, TWO_PI);
  translate(50, 50);
  rotate(angle);
  line(0, 0, 40, 0);
}
  • Write a sketch to create an x,y coordinate system familiar from algebra. That is, shift the origin to the center of the drawing window, drawing an x-axis and a y-axis. Then draw an ellipse centered at the new (0,0) point. Give the ellipse some color you like, and make it partially transparent.
  • Copy the sketch 14-11 from Learning Processing and run it. Modify the color of the rectangle and find a way to modify the speed at which it scales.

Demonstrate your sketches to the instructor.

cs276/spc.lab5.txt · Last modified: 2022/09/20 18:09 by scarl