Skip to content

Endshape in Instance mode doesn't work if called from mouseDragged #4960

@Nahiiko

Description

@Nahiiko

Hi guys !

This is my 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);

the EndShape call doesn't work. I think it should, is this a bug ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions