Hit F12 key in order to open browser's JS console.
Then clicked "edit" button and changed the constant being used in blendMode() to ADD.
After clicking "run", nothing wrong shown up to me though... :-\"
for (var i=0; i<bolas.length; i++) {
bolas[i].move();
bolas[i].display();
}
}
function windowResized()
{
resizeCanvas(windowWidth, windowHeight);
}
// Bola class
function Bola()
{
this.diameter = random(90, 190);
this.radRan = random(1.4, 3);
this.radius = this.diameter/this.radRan;
var loc = createVector(random(width), random(height/4, height-height/4));
var vel = createVector(random(-.3,.3),random(-.1,.1));
var newSize = random(1.5, 2.5);
var newSize2 = random(1.5, 2.5);
Answers
I've visited its reference page here:
http://p5js.org/reference/#/p5/blendMode
Hit F12 key in order to open browser's JS console.
Then clicked "edit" button and changed the constant being used in blendMode() to ADD.
After clicking "run", nothing wrong shown up to me though... :-\"
Cross-posted here: https://GitHub.com/processing/p5.js/issues/882
I see, but it's not working in my browser when I try to blend images like this:
```var front;
var back;
var bolas = []; // Array Bola objects
// Images function preload() { front = loadImage('assets/bolaColFront.png'); back = loadImage('assets/bolaColBack.png'); }
function setup() { createCanvas( windowWidth, windowHeight ); colorMode(HSB, 360, 100, 100); noStroke();
// Create objects for (var i=0; i<50; i++) { bolas.push(new Bola()); } }
function draw() { background(5); smooth();
for (var i=0; i<bolas.length; i++) { bolas[i].move(); bolas[i].display(); } }
function windowResized() { resizeCanvas(windowWidth, windowHeight); }
// Bola class function Bola() { this.diameter = random(90, 190); this.radRan = random(1.4, 3); this.radius = this.diameter/this.radRan; var loc = createVector(random(width), random(height/4, height-height/4)); var vel = createVector(random(-.3,.3),random(-.1,.1)); var newSize = random(1.5, 2.5); var newSize2 = random(1.5, 2.5);
this.move = function() { loc.add(vel); };
this.display = function() { blendMode(SCREEN); imageMode(CENTER); image(back, loc.x, loc.y, this.diameter, this.diameter); image(front, loc.x, loc.y, this.radius, this.radius);
};
}```
http://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
And I can't see any
blendMode(ADD);
butblendMode(SCREEN);
instead! ~:>Hi, sorry for the format. I was using and old version of p5js. Now it works perfect. Thank you!