We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm trying to make a dropdown list that draws a shape based on what is selected, how do I go about doing that, here's what I have so far:
var sel;
function setup() {
createCanvas(1000, 1000)
textAlign(CENTER);
background(255);
sel = createSelect();
sel.position(10, 10);
sel.option(1);
sel.option(2);
sel.option(3);
sel.changed(changed);
}
function changed() {
var item = sel.value();
if (item = 1) {
fill(51);
ellipse(56, 46, 55, 55);
}
if (item = 2) {
fill(51);
ellipse(106, 46, 55, 55);
}
if (item = 3) {
fill(51);
ellipse(156, 46, 55, 55);
}
}
I'm using p5.dom. I want the ellipses to be drawn if you select 1, 2, or 3. Thanks!
Answers
@GoToLoop thank you! I'm new to coding so sorry if it was obvious!
=
http://ProcessingJS.org/reference/assign/ ISN'T==
http://ProcessingJS.org/reference/equality/ #-ohttps://thimbleprojects.org/migashi/381955/
Kf