Created
July 18, 2016 21:25
-
-
Save genekogan/87f9eb879ba75161be2e8fd0a2f5bd09 to your computer and use it in GitHub Desktop.
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 processing.video.*; | |
Movie movie1, movie2; | |
int blendAlpha; | |
int typeBlend; | |
import oscP5.*; | |
import netP5.*; | |
OscP5 oscP5; | |
void setup() { | |
size(1280, 720, P2D); | |
oscP5 = new OscP5(this,12000); | |
background(0); | |
// change the paths to these movies | |
movie1 = new Movie(this, "/Users/gene/Media/german_train_grid.mov"); | |
movie2 = new Movie(this, "/Users/gene/Desktop/bees_and_bombs2.mp4"); | |
movie1.loop(); | |
movie2.loop(); | |
//typeBlend = REPLACE; | |
typeBlend = BLEND; | |
} | |
void movieEvent(Movie m) { | |
m.read(); | |
} | |
void draw() { | |
//blendAlpha = int(map(mouseX, 0, width, 0, 255)); | |
tint(255, 255); | |
image(movie1, 0, 0, width, height); | |
blendMode(typeBlend); | |
tint(255, blendAlpha); | |
image(movie2, 0, 0, width, height); | |
} | |
void mousePressed() { | |
if (typeBlend == REPLACE) typeBlend = BLEND; | |
else if (typeBlend == BLEND) typeBlend = ADD; | |
else if (typeBlend == ADD) typeBlend = SUBTRACT; | |
else if (typeBlend == SUBTRACT) typeBlend = LIGHTEST; | |
else if (typeBlend == LIGHTEST) typeBlend = DARKEST; | |
else if (typeBlend == DARKEST) typeBlend = DIFFERENCE; | |
else if (typeBlend == DIFFERENCE) typeBlend = EXCLUSION; | |
else if (typeBlend == EXCLUSION) typeBlend = MULTIPLY; | |
else if (typeBlend == MULTIPLY) typeBlend = SCREEN; | |
else if (typeBlend == SCREEN) typeBlend = REPLACE; | |
println("Blend mode : " + typeBlend); | |
} | |
void oscEvent(OscMessage theOscMessage) { | |
String address = theOscMessage.addrPattern(); | |
if (address.equals("/wek/outputs")) { | |
float myValue = theOscMessage.get(0).floatValue(); | |
blendAlpha = int(map(myValue, 0, 1.0, 0, 255)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment