Button with 3 positions

Hi!
I wonder if anyone has created a “button” which you can draw into three different positions and would like to share it here

@Pontus712 Not sure if this is what you’re after, but tap the top or bottom of the button.
EDIT: Changed the code.

function setup()
    pos=1
end

function draw()
    background(0)
    fill(255)
    rect(200,200,50,180)  
    fill(255,0,0)
    rect(200,200+pos*60,50,60)
end

function touched(t)   
    if t.state==BEGAN then
        if t.x>200 and t.x<250 then
            if t.y>320 then
                pos=pos+1
            else
                pos=pos-1
            end
            pos=math.min(pos,2)
            pos=math.max(pos,0)
        end
    end
end

@Pontus712.Or you can just touch one of the 3 button positions in this version.

function setup()
    pos=1
end

function draw()
    background(0)
    fill(255)
    rect(200,200,50,180)  
    fill(255,0,0)
    rect(200,200+pos*60,50,60)
end

function touched(t)   
    if t.state==BEGAN then
        if t.x>200 and t.x<250 and t.y>200 and t.y<380 then
            if t.y>320 then
                pos=2
            elseif t.y>260 then
                pos=1
            else
                pos=0
            end
        end
    end
end