Week 7 Tut­o­r­i­a­l Ass­i­g­n­m­e­n­t

by Tsz Kwong Marco Tong
  • Show Code
/** @peep sketch */
String scrollingText = "THIS IS DECENDING ORDER.";
 
float x;
float dx = 1;
 
void setup() {
  size(200, 200);
  PFont font = createFont("/media/css/Chunkfive-webfont.ttf", 72);
  textFont(font);
  x = width;
}
 
void draw() {
  background(204);
  fill(0);
  textAlign(RIGHT, CENTER);
  text(scrollingText, x, height/2 + 20);
  x += dx;
  if (x <= -textWidth(scrollingText)) x = 200;
}

Comments

Nobody has said anything yet.