Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p5js button.mousePressed calls function + arguments?

probably silly question but is this possible or not in p5js?

function setup() {
   myButton.mousePressed(toggleVideo(1)); //This toggleVideo works well without argument
}

function toggleVideo(v) {
    blablabla[v].loop();
}  

Many thanks!

like image 718
Afzhal Avatar asked Feb 28 '16 09:02

Afzhal


1 Answers

Use

mousePressed(function() { toggleVideo(1);});
like image 188
H.Scheidl Avatar answered Oct 01 '22 04:10

H.Scheidl