csb – face-osc – text-embedded easter egg
CODE:
import oscP5.*;
OscP5 oscP5;
// num faces found
int found;
// pose
float poseScale;
PVector posePosition = new PVector();
PVector poseOrientation = new PVector();
// gesture
float mouthHeight;
float mouthWidth;
float eyeLeft;
float eyeRight;
float eyebrowLeft;
float eyebrowRight;
float jaw;
float nostrils;
String[] lines;
int string_spacing = 20;
void setup() {
size(804, 805, P3D);
background(0);
lights();
lines = loadStrings(“lorem_ipsum.txt”);
oscP5 = new OscP5(this, 8338);
oscP5.plug(this, “found”, “/found”);
oscP5.plug(this, “poseScale”, “/pose/scale”);
oscP5.plug(this, “posePosition”, “/pose/position”);
oscP5.plug(this, “poseOrientation”, “/pose/orientation”);
oscP5.plug(this, “mouthWidthReceived”, “/gesture/mouth/width”);
oscP5.plug(this, “mouthHeightReceived”, “/gesture/mouth/height”);
oscP5.plug(this, “eyeLeftReceived”, “/gesture/eye/left”);
oscP5.plug(this, “eyeRightReceived”, “/gesture/eye/right”);
oscP5.plug(this, “eyebrowLeftReceived”, “/gesture/eyebrow/left”);
oscP5.plug(this, “eyebrowRightReceived”, “/gesture/eyebrow/right”);
oscP5.plug(this, “jawReceived”, “/gesture/jaw”);
oscP5.plug(this, “nostrilsReceived”, “/gesture/nostrils”);
}
float i = 0;
float count = 0;
void draw() {
//baby();
lorum();
//pushMatrix();
//translate(422, height*0.52, -366);
//sphere(noise(204));
//popMatrix();
i = i + 1;
count = count + 1;
string_spacing+=100;
}
void lorum() {
for (int n = 0; n < lines.length; n+=1) {
baby();
translate(0, string_spacing+posePosition.y);
text(lines[n], poseOrientation.x, noise(20)+string_spacing);
}
string_spacing = 0;
//background(0,253);
}
void baby() {
fill(-16, 130, 5, 84);
stroke(212, 101, 309, 429);
// translate(eyeLeft, eyeRight, mouthHeight);
translate(eyeLeft*30.0, posePosition.y, -155);
sphere((mouthHeight*150));
translate(eyeRight*30.0, posePosition.y, -155);
sphere((mouthHeight*150));
int sizing = abs(int(70 /poseScale));
textSize(sizing);
fill(0, 102, 153);
text("word", posePosition.x, posePosition.y, posePosition.z+100); // Specify a z-axis value
text("Default depth, no z-value specified", posePosition.x, posePosition.y, posePosition.z); // Default depth, no z-value specified
String s = "The quick brown fox jumped over the lazy dog.";
fill(243);
text(s, posePosition.x-135, posePosition.y+-21, posePosition.z+-153, 279); //
text("Text wraps within text box", poseOrientation.x, poseOrientation.y, poseOrientation.z, poseScale);
}
//ellipse(noise(poseScale), poseOrientation.x, mouthHeight, posePosition.y);
// OSC CALLBACK FUNCTIONS
public void found(int i) {
println("found: " + i);
found = i;
}
public void poseScale(float s) {
println("scale: " + s);
poseScale = s;
}
public void posePosition(float x, float y) {
println("pose position\tX: " + x + " Y: " + y );
posePosition.set(x, y, 0);
}
public void poseOrientation(float x, float y, float z) {
println("pose orientation\tX: " + x + " Y: " + y + " Z: " + z);
poseOrientation.set(x, y, z);
}
public void mouthWidthReceived(float w) {
println("mouth Width: " + w);
mouthWidth = w;
}
public void mouthHeightReceived(float h) {
println("mouth height: " + h);
mouthHeight = h;
}
public void eyeLeftReceived(float f) {
println("eye left: " + f);
eyeLeft = f;
}
public void eyeRightReceived(float f) {
println("eye right: " + f);
eyeRight = f;
}
public void eyebrowLeftReceived(float f) {
println("eyebrow left: " + f);
eyebrowLeft = f;
}
public void eyebrowRightReceived(float f) {
println("eyebrow right: " + f);
eyebrowRight = f;
}
public void jawReceived(float f) {
println("jaw: " + f);
jaw = f;
}
public void nostrilsReceived(float f) {
println("nostrils: " + f);
nostrils = f;
}
// all other OSC messages end up here
void oscEvent(OscMessage m) {
/* print the address pattern and the typetag of the received OscMessage */
println("#received an osc message");
println("Complete message: "+m);
println(" addrpattern: "+m.addrPattern());
println(" typetag: "+m.typetag());
println(" arguments: "+m.arguments()[0].toString());
if(m.isPlugged() == false) {
println("UNPLUGGED: " + m);
}
}
lorem_ipsum