We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I am trying to fade in and out a video in relationship to mouse position. There are two videos playing: one on top of the other. When I get close to the y-axis, the video stalls and gets glitchy. Is there a better way to do this?
I am pretty new to processing, but here is my code:
import processing.video.*; float trans;
Movie light; Movie fog;
void setup() { size(854, 480); background(0); light = new Movie(this, "ChathamLighthouse.mp4"); fog = new Movie(this, "Fog.mp4"); fog.loop(); light.loop(); }
void draw() { trans = (mouseX/3);
frameRate(25); image(light, 0, 0, width, height);
tint(255, trans); image(fog, 0, 0, width, height); }
void movieEvent(Movie m) { m.read(); }
Answers
Hi,
what you are looking for is the map()-function. :)
Brilliant — this works very well. Thank you!