« CTIN 544 - First Processing sketch | Main | CTIN 544 Library Assignment »

CTIN 405 - Sketch 1

Here's the code for my first sketch using Mobile Processing:

int[] sqrWidth = new int[5];
int[] sqrHeight = new int[5];
int letterX = 0;
int letterY = 0;
String str = "SIEHEHFBEICBT592483659234875290348578243075824ROISBHRKUSHBRSUBIRBUKUBHFKJHBSIQBIQRHBQO";

void setup()
{
sqrWidth[1] = 5;
sqrWidth[2] = 176;
letterX = random(width);
letterY = random(height);

background(255);
noStroke();
fill(0);

PFont font;
font = loadFont(FACE_SYSTEM, STYLE_PLAIN,SIZE_MEDIUM);
textFont(font);
textAlign(CENTER);
rectMode(CORNERS);
}

void draw()
{
background(random(255),random(255),random(255));

if(keyPressed)
{
letterX = random(width);
letterY = random(height);
}

char c[] = {str.charAt(random(85))};
String str2 = new String(c);

text(str2, letterX,letterY);

fill(random(255),random(255),random(255));
sqrWidth[1] = (sqrWidth[1] + 1) % 176;
sqrHeight[1] = pointerY;
rect(0,0,sqrWidth[1],sqrHeight[1]);

fill(random(255),random(255),random(255));
sqrWidth[2] = (sqrWidth[2] - 1) % 176;
sqrHeight[2] = pointerY;
rect(sqrWidth[2],sqrHeight[2],176,208);
}

Post a comment

About

This page contains a single entry from the blog posted on January 26, 2009 12:15 PM.

The previous post in this blog was CTIN 544 - First Processing sketch.

The next post in this blog is CTIN 544 Library Assignment.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.31