Another tween viewer and problems

Here is another tween viewer that I created from my previous one. Use the parameter sliders to select the different tween options. When using the options pingpong or forever, use the sliders to select a different parameter option to stop the current example. There a 2 points when viewing a normal tween, and 4 points when viewing a tween.path . @Simeon, there are some tween.path options that cause errors. I didn’t try every option, but here are some of them. They seem to be only in tween.path. Options “once, expo, In, tween.path”, “once, back, In, tween.path”, “once, elastic, In, tween.path”, “once, elastic, Out, tween.path”, “once, back, InOut, tween.path”, “once, elastic, InOut, tween.path”. I don’t know if I’m doing something wrong or if some options don’t work under tween.path. Some of the errors don’t happen the first time, but maybe the next. The errors that show don’t give me any idea of what’s wrong.


function setup() 
    parameter.integer("looping",1,3,1)
    parameter.integer("easing",1,11,1)
    parameter.integer("InOut",1,4,1)
    parameter.integer("twType",1,2,1)
            
    tw=nil
    show=true
    
    cir={x=100,y=100}
    p1={x=100,y=100}
    p2={x=400,y=900}
    p3={x=400,y=100}
    p4={x=100,y=900}
    
    w={"In","Out","InOut","OutIn"}
    w1={"once","pingpong","forever"}
    pa={"tween","tween.path"}
    
    t1={"linear","quad","cubic","quart","quint","expo","sine","back","bounce","circ","elastic"}   
    p={tween.loop.once,tween.loop.pingpong,tween.loop.forever}
    
    t21={tween.easing.linear,tween.easing.quadIn,tween.easing.cubicIn,tween.easing.quartIn,
    tween.easing.quintIn,tween.easing.expoIn,tween.easing.sineIn,tween.easing.backIn,
    tween.easing.bounceIn,tween.easing.circIn,tween.easing.elasticIn}
    
    t22={tween.easing.linear,tween.easing.quadOut,tween.easing.cubicOut,tween.easing.quartOut,
    tween.easing.quintOut,tween.easing.expoOut,tween.easing.sineOut,tween.easing.backOut,
    tween.easing.bounceOut,tween.easing.circOut,tween.easing.elasticOut}
    
    t23={tween.easing.linear,tween.easing.quadInOut,tween.easing.cubicInOut,tween.easing.quartInOut,
    tween.easing.quintInOut,tween.easing.expoInOut,tween.easing.sineInOut,tween.easing.backInOut,
    tween.easing.bounceInOut,tween.easing.circInOut,tween.easing.elasticInOut}
        
    t24={tween.easing.linear,tween.easing.quadOutIn,tween.easing.cubicOutIn,tween.easing.quartOutIn,
    tween.easing.quintOutIn,tween.easing.expoOutIn,tween.easing.sineOutIn,tween.easing.backOutIn,
    tween.easing.bounceOutIn,tween.easing.circOutIn,tween.easing.elasticOutIn}  
  
end

function setup1() 
    cir={x=100,y=100}
    if InOut==1 then
        if twType==1 then
            tw=tween(2,cir,{x=400,y=900},{easing=t21[easing],loop=p[looping]}, done)
        else
            tw=tween.path(5,cir,{p1,p2,p3,p4,p1},{easing=t21[easing],loop=p[looping]},done)
        end
    elseif InOut==2 then
        if twType==1 then
            tw=tween(2,cir,{x=400,y=900},{easing=t22[easing],loop=p[looping]}, done)
        else
            tw=tween.path(5,cir,{p1,p2,p3,p4,p1},{easing=t22[easing],loop=p[looping]}, done)
        end
    elseif InOut==3 then
        if twType==1 then
            tw=tween(2,cir,{x=400,y=900},{easing=t23[easing],loop=p[looping]}, done)
        else
            tw=tween.path(5,cir,{p1,p2,p3,p4,p1},{easing=t23[easing],loop=p[looping]}, done)
        end
    else
        if twType==1 then
            tw=tween(2,cir,{x=400,y=900},{easing=t24[easing],loop=p[looping]}, done)
        else
            tw=tween.path(5,cir,{p1,p2,p3,p4,p1},{easing=t24[easing],loop=p[looping]}, done)
        end
    end
end

function done()    -- tween is done
    show=true  
end

function draw()
    background(40,40,50)
    fill(255,0,0)
    textMode(CORNER)
    fontSize(17)
    text(w1[looping],10,940)
    text(t1[easing],10,860)
    text(w[InOut],10,780)
    text(pa[twType],10,700)
    textMode(CENTER)
    fill(255)
    fontSize(40)
    text("1",100,100)
    text("2",400,900)
    if twType==2 then
        text("3",400,100)
        text("4",100,900)
    end
    if show then
        text("Tap screen to start",WIDTH/2,HEIGHT/2)
    end
    if te1~=easing or lo1~=looping or tw1~=twType or io1~=InOut then
        te1=easing
        lo1=looping
        tw1=twType
        io1=InOut
        if tw~=nil then
            tween.stop(tw)
        end
        cir.x=100
        cir.y=100
        show=true
    end
    noFill()
    strokeWidth(2)
    ellipse(cir.x,cir.y,50)
end

function touched(t)
    if t.state==BEGAN and show then
        show=false
        setup1()
    end
end