Tut­o­r­i­a­l week 7

by Brittany Klaassens

speed and position:

  • Show Sketch
/* @pjs font=/media/css/Chunkfive-webfont.ttf; */
/** @peep sketchcode */
 
String scrollingText = "britty k";
 
float x;
float dx = -2; 
 
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(LEFT, CENTER);
  text(scrollingText, x, height/5 + 20);
  x += dx;
  if (x <= -textWidth(scrollingText)) x = 200;
}

self uploaded:

  • Show Sketch
/* @pjs preload="/uploads/16186/images.jpg; */
/** @peep sketchcode */
size(200, 200);
PImage img;
img = loadImage("/uploads/16186/images.jpg");
image(img, 25, 25, 150, 150);

Comments

Nobody has said anything yet.