Guodu-FaceOSC

fsdf

Inspired by Text Rain and Typeface2 by Mary Huang. In the process, I became intrigued by painting with type, with one’s face movements.

gif1
Type as a path
gif2
Got into rotating type

gif4

gif5

// a template for receiving face tracking osc messages from
// Kyle McDonald's FaceOSC https://github.com/kylemcdonald/ofxFaceTracker
//
// 2012 Dan Wilcox danomatika.com
// for the IACD Spring 2012 class at the CMU School of Art
//
// adapted from from Greg Borenstein's 2011 example
// http://www.gregborenstein.com/
// https://gist.github.com/1603230
//

import oscP5.*;
OscP5 oscP5;
// num faces found
int found;
float[] rawArray;
//which point is selected
int highlighted;
String word = "HelloWorld";
//int wordIndex = int(random(wordBank.length));
float textX;
float textY;
//float speed = 1;
float speed = .01;
//float posX = rawArray[0];

//float textSize = random(0 30);
float textSize = 30;
float rgbColor = random(255);

void setup() {
size(640, 480);
frameRate(30);
oscP5 = new OscP5(this, 8338);
oscP5.plug(this, "found", "/found");
oscP5.plug(this, "rawData", "/raw");

textAlign(CENTER);
textX = random(width);
}
void draw() {
//background(255);
//stroke(0);
//noStroke();
//background(255, 0, 0, 10);
textSize(textSize);

if(found > 0) {
for (int val = 0; val < rawArray.length -1; val+=2){
if (val == highlighted){ fill(255,0,0);}
else{fill(100);}

//ellipse(rawArray[val], rawArray[val+1],8,8);
//text("Use Left and Right arrow keys to cycle through points",20,20);
//text( "current index = [" + highlighted + "," + int(highlighted + 1) + "]", 20, 40);
//println(rawArray[val]);
fallingWords();
}
}
}
void fallingWords(){

float rgbColor = random(255);
textY = textY+speed;
float x1=map(textY, 0, height, 0, 255);
fill(rgbColor+x1, 102, 153, 80);
textSize = rawArray[128]/5;
rotate(rawArray[100]);
text(word, rawArray[100], textY);
if (textY > height){
//reset text's falling placement (textX, textY) and speed
textX = random(width);
textY = 0;
//speed = 1;
speed = random(.01,.1);
background(204,204,204);

}
}
void keyPressed(){
if (keyCode == RIGHT){
highlighted = (highlighted + 2) % rawArray.length;
}
if (keyCode == LEFT){
highlighted = (highlighted - 2) % rawArray.length;
if (highlighted < 0){highlighted = rawArray.length-1;
}
}
}
/////////////////////////////////// OSC CALLBACK FUNCTIONS//////////////////////////////////
public void found(int i) {
println("found: " + i);
found = i;
}
public void rawData(float[] raw) {
println("raw data saved to rawArray");
rawArray = raw;

}