Hi, I’m really new to p5js and right now I’m making a rain effect in p5. It went well with a background color in my canvas. ( https://cl.ly/d49185682356 )
However, What I want to do is making the background transparent so I can combine it with my HTML image. But, the raindrop leaves traces in my draw loop without the background color. ( https://cl.ly/1501612cdf8d ) , I tried to play with the transparency but it does not work either…
So, maybe anyone can help ? How to clear the rain traces in my transparent background?
In effect, you want to “erase the board” every draw()
An idea that comes to mind is to draw a transparent rectangle over everything, in conjunction with blendMode(REPLACE). Instead of drawing over, it will replace all pixels.
Thanks for the idea ! but I’m little bit confused with the blendmode , because it still leave a transparent trace , where should i put the blendMode(Replace) attribute though.
Hi just come back from autumn holiday, I guess I’m not quite good at this , so maybe I’ll post the code. Thanks for your feedback though it really helps !
var drop = [];
// function WindowResize() {
// resizeCanvas(windowWidth,windowHeight);
// }
function setup() {
blendMode(REPLACE);
createCanvas(windowWidth,windowHeight);
for (var i = 0; i < 200; i++) {