Loading, layering and transparency in Processing
in
Programming Questions
•
29 days ago
Hello Everybody
I'm new here and I'm working at a Photo-Project and I desperately need your help.
First of all, is there any way to load pictures into Processing directly from the camera, without needing to import them first into the data-sketch folder?
Secondly, I found the basic code for putting transparency to pictures. Now I want transparency, but on multiple layers. This means that I want put 10 times the same picture on top of each, but every with a different displacement to the orig. background img. And each of them transparent, obviously.
I used this code:
PImage img; float offset = 0; float easing = 0.05;
void setup() { size(640, 360);
img = loadImage("moonwalk.jpg"); // Load an image into the program
}
void draw() { image(img, 0, 0); // Display at full opacity
float dx = (mouseX-img.width/2) - offset; offset += dx * easing;
tint(255, 126); // Display at half opacity
image(img, offset, 0); }
But instead of a floating img. through the mouse movements i need it steady. I just varied the .width/2 to .width/42 and deletet mouseX-img. It worked out more or less, but I dont think thats the propper way.
Can ANYBODY help me or give me some advice? I would highly appreciate it and would be very thankfull.
Kind regards
D.
1