EARTH 801
Computation and Visualization in the Earth Sciences

Lesson 5: Combining Lesson 5 Skills

PrintPrint

This is a short program that combines skills from this lesson. I import a font and write a word to the screen. I also translate the coordinate system and rotate continuously so that the word spins around its own center.

// the word "pinwheel" spins around

PFont  font1;
float rotAngle = 0;

void setup(){
  size(200,200);
  font1 = loadFont("Herculanum-48.vlw");
  textFont(font1);
  textAlign(CENTER);
}

void draw(){
  background(11,139,1);
  translate(width/2,height/2);
  rotate(rotAngle);
  text("pinwheel",0,0);
  rotAngle += 0.01;
}
screenshot from pinwheel program
Screenshot from pinwheel program
E. Richardson

Quiz yourself

Quiz yourself again