p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

p5.js blend example

Open jedahan opened this issue 12 years ago • 6 comments

Having a bit of trouble getting it working, it would be helpful to have an example. I'll try to make an example today.

jedahan avatar Nov 24 '14 17:11 jedahan

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);

}

dnassler avatar Nov 26 '14 16:11 dnassler

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);

}

dnassler avatar Nov 26 '14 21:11 dnassler

@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...

lmccart avatar Dec 05 '14 13:12 lmccart

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.

jedahan avatar Dec 07 '14 17:12 jedahan

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.

lmccart avatar Dec 07 '14 17:12 lmccart

Thanks!

jedahan avatar Dec 15 '14 19:12 jedahan