Media Theory for the 21st Century

January 29, 2008

hello world

Filed under: Discussion — johnbcarpenter @ 7:20 am
Tags: , , ,

//code is written in processing, for more info see
//set the initial variables for the program
//initial text location
int textX = 50;
int textY = 50;

//initial text speed (X and Y)
int textSpeedX = 1;
int textSpeedY = 2;
void setup(){ /*void is a keword indicating a function
  setup–Called once when the program is started. 
  Used to define initial enviroment properties 
  such as screen size, background color, loading images, etc. 
  before the draw() begins executing. */
  size(200, 200);


void draw() {
  //load/setup the font
  PFont font; //PFont is the font class for Processing 
  font = loadFont(“Courier-14.vlw”);   //loadFont loads a font 
  //into a variable of type PFont
  textFont(font, 14);   //textFont sets the current font

  //create the trailing effect
  fill(128, 10);
  rect(-1, -1, width+1, height+1);

  //choose text color + draw text to the screen
  text(“hello world”, textX, textY);

  //reverse text direction when it reaches the edge of the window
  if((textX >= (width-90)) || (textX <= 0)){
    textSpeedX = textSpeedX*(-1);
  if((textY >= height) || (textY <= 8)){
    textSpeedY = textSpeedY*(-1);

  //update the text location in the window
  textX = textX+textSpeedX;
  textY = textY+textSpeedY;

processing applet image capture               

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: