p5.js blend example
Having a bit of trouble getting it working, it would be helpful to have an example. I'll try to make an example today.
Here is an example that works....
function setup() { createCanvas(window.innerWidth, window.innerHeight);
noLoop(); background(0,100,200); blendMode(EXCLUSION); fill(255); noStroke(); rect(100,100,100,100); rect(150,150,150,150);
}
I'm seeing some issues though with ADD and BLEND. ADD is not defined. And BLEND seems to be affected by previously specified blendMode...
function setup() { createCanvas(window.innerWidth, window.innerHeight);
noLoop(); background(0,100,200);
fill(255); noStroke();
blendMode(EXCLUSION); rect(100,100,100,100); rect(150,150,500,500);
fill(200);
blendMode(BLEND); // seems to be affected by the previous blendMode rect(50,250,150,150);
blendMode(OVERLAY); rect(250,50,175,175);
blendMode(BURN); rect(500,150,200,50);
blendMode(MULTIPLY); rect(500,175,200,50);
blendMode(SCREEN); rect(500,300,200,50);
blendMode(REPLACE); rect(500,400,200,50);
blendMode(OVERLAY); rect(500,500,200,50);
blendMode(HARD_LIGHT); rect(500,600,200,50);
blendMode(SOFT_LIGHT); rect(500,700,200,50);
//blendMode(ADD); // doesn't work, ADD is not defined //rect(225,250,200,200);
blendMode(LIGHTEST); rect(225,250,200,200);
blendMode(DARKEST); rect(225,500,200,200);
}
@jedahan what sort of example are you looking for? there are a couple here: http://p5js.org/reference/#p5/blendMode but I could add more...
I think I was looking at blend instead of blendMode, even though blendMode is closer to what I was looking for when writing the sketch.
ah ok! I'll try to add an example for this soon. or feel free to add one in if you've figure it out.
Thanks!