Dropdown Menu Question

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!

Sign In or Register to comment.