Hi guys,
It’s all in the title, here is an example of the code:
var s1 = function( sketch ) {
sketch.setup = function() {
let canvas1 = sketch.createCanvas(400, 400, sketch.WEBGL);
canvas1.position(0,0);
canvas1.background(“blue”);
}
sketch.mousePressed = function(){
sketch.beginShape();
sketch.fill(“green”);
}
sketch.mouseDragged = function(){
sketch.curveVertex(sketch.mouseX-200,sketch.mouseY-200);
}
sketch.mouseReleased = function(){
sketch.endShape();
}
};
new p5(s1);
var s2 = function( sketch ) {
sketch.setup = function() {
var canvas1 = sketch.createCanvas(400, 400, sketch.WEBGL);
canvas1.position(400,0);
canvas1.background(0,0,0,0);
}
sketch.mousePressed = function(){
sketch.beginShape();
sketch.fill(“yellow”);
}
sketch.draw = function(){
sketch.curveVertex(sketch.mouseX-205,sketch.mouseY-200);
sketch.endShape();
}
sketch.mouseReleased = function(){
}
};
// create the second instance of p5 and pass in the function for sketch 2
new p5(s2);
So for example the EndShape call in mouseReleased in this example works, but not the one in mouseDragged.
Hopefully someone has an answer !
Thanks !