Created
February 10, 2012 18:07
-
-
Save mrichardson23/1791336 to your computer and use it in GitHub Desktop.
FaceOSC and Processing for Faux 3D Effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import oscP5.*; OscP5 oscP5; | |
float posePositionX; | |
float posePositionY; | |
float poseScale; | |
PImage interior; | |
PImage exterior; | |
void setup() { | |
size(1000,667); | |
oscP5 = new OscP5(this, 8338); | |
oscP5.plug(this, "posePosition", "/pose/position"); | |
oscP5.plug(this, "poseScale", "/pose/scale"); | |
interior = loadImage("interior.png"); | |
exterior = loadImage("exterior.jpg"); | |
imageMode(CENTER); | |
} | |
void draw() { | |
float exteriorScale = map(poseScale, 6, 2, 1, 1.1); | |
float interiorScale = map(poseScale, 6, 2, 1.5, 1); | |
float exteriorImagePosX = map(posePositionX, 60, 586, 50, -50) + width/2; | |
float exteriorImagePosY = 30 - map(posePositionY, 60, 370, 50,-50) + height/2; | |
image(exterior, exteriorImagePosX, exteriorImagePosY, exterior.width * exteriorScale, exterior.height * exteriorScale); | |
image(interior, width/2, height/2, interior.width * interiorScale, interior.height * interiorScale); | |
} | |
public void posePosition(float x, float y) { | |
println("pose position\tX: " + x + " Y: " + y ); | |
posePositionX = x; | |
posePositionY = y; | |
} | |
public void poseScale(float s) { | |
println("scale: " + s); | |
poseScale = s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment