We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am using instance mode to have multiple canvases on a page. Is there a way to have functions that draw shapes available to either canvas? For example, in the code below, how can I make the drawLine() function work when called?
var l = function( p ) {
p.setup = function() {
p.createCanvas(400, 600);
};
p.draw = function() {
drawLine();
};
};
function drawLine(){
line(0,0,100,100);
}
My other solution is to change my functions so they just output numbers, which then get accessed and draw within the draw loop, but if anyone has a solution to the above problem, it would help me a lot! Thanks!
Answers
Thanks! I tried a bunch of things to link the function with the canvas to no avail, but this works perfectly.