Overlay sketch on movie

I’m trying to overlay a drawing sketch on a movie. The sketch I’m using is “RandomWalkLevy” from Daniel Shiffman’s “The Nature of Code”, which calls two functions in the main draw() block. However, the trace of the drawing movement is erased by the new frames of the video. I have tried adapting the code here

to create a top layer to put the drawing code. However, I’m not sure what to put between topLayer.beginDraw(); and topLayer.endDraw(); to make the Walker code work.
Any help greatly appreciated.

import processing.video.*;

Movie myMovie;

PGraphics topLayer;

void setup()
size(640, 480);
myMovie = new Movie(this, “station.mov”);
topLayer = createGraphics(width, height, g.getClass().getName());

void movieEvent(Movie myMovie)

void draw()
image(myMovie, 0,0, width, height);
topLayer.stroke( 255 );
topLayer.line( pmouseX, pmouseY, mouseX, mouseY );
image( topLayer, 0, 0 );

If you are trying to replicate the trace effect of a non-cleared background, take look at objects. Shiffman explains it well in this video:

1 Like

I guess blendMode has something to do with it, since the default setting is on blendMode(BLEND);

I get different results, cycling through them for either one of the two, the PGraphics or the movie.
none of them are really satisfying, but in some modes you can see the movie and the traced line.

did not try all the different cases of all the mode combinations possible…

1 Like

Thanks for the two replies. (And apologies for the delay in acknowledging them.)