// Videos from www.pexels.com import processing.video.*; Movie v1, v2; PGraphics mask; void setup() { size(960, 540); blendMode(MULTIPLY); v1 = new Movie(this, "vid1.mp4"); v1.loop(); v2 = new Movie(this, "vid2.mp4"); v2.loop(); mask = createGraphics(width, height); while (!v1.available() || !v2.available()) { } } void draw() { if (v1.available()) { v1.read(); } if (v2.available()) { v2.read(); } mask.beginDraw(); mask.blendMode(DIFFERENCE); mask.background(255); // Peindre le fond d'une couleur unie mask.fill(255); // Choisir une couleur de remplissage mask.circle(mouseX, mouseY, 600 + 300*sin(millis()/350.0)); // Dessiner un cercle mask.circle(mouseX, mouseY, 600 + 300*sin(millis()/330.0)); // Dessiner un cercle mask.circle(mouseX, mouseY, 600 + 300*sin(millis()/310.0)); // Dessiner un cercle mask.circle(mouseX, mouseY, 600 + 300*sin(millis()/290.0)); // Dessiner un cercle mask.circle(mouseX, mouseY, 600 + 300*sin(millis()/270.0)); // Dessiner un cercle mask.endDraw(); mask.loadPixels(); loadPixels(); for (int i=0; i<width*height; i++) { if (mask.pixels[i] == 0xFF000000) { pixels[i] = v2.pixels[i]; } else { pixels[i] = v1.pixels[i]; } } updatePixels(); }
PImage img; PGraphics grain; void settings() { img = loadImage("flat.jpg"); //img.resize(500, 0); size(img.width, img.height); } void setup() { grain = createGraphics(width, height); grain.beginDraw(); grain.background(255); //grain.fill(0, 0, 0, 30); //grain.noStroke(); grain.stroke(0, 30); for (int i=0; i<8000; i++) { //grain.circle(random(width), random(height), 2.5); grain.line(random(width), random(height), random(width), random(height)); } grain.endDraw(); grain.loadPixels(); colorMode(HSB); image(img, 0, 0); loadPixels(); for (int i=0; i<width*height; i++) { color c = pixels[i]; float h = hue(c); float s = saturation(c); float b = brightness(c); float a = red(grain.pixels[i])-128; if (i%width < width/2) pixels[i] = color(h + a*0.3, s, b + a*0.5); } updatePixels(); //image(grain, 0, 0); }