Swipe Function?

I was wondering if using a swiping gesture to move text and buttons across a screen in order to transition from my main screen to another screen would be possible in Codea, or should I use XCode for the gesture?

@YoloSwag You can have one set of text and buttons on your main screen, and have another set of text and buttons on other screens. It’s very easy to have different things on different screens and transition from one screen to another. There are many examples of multiple screens in previous discussions. You can do a forum search by using the search box that’s on the right side of the screen just above “Start a New Discussion”.

@YoloSwag Here’s an example of a swiping gesture to move from one screen to another. Since I don’t know what you’re after, I didn’t go into much detail with the screens.


displayMode(FULLSCREEN)

function setup()
    rectMode(CENTER)
    dx=0
end

function draw()
    background(40, 40, 50)
    
    fill(255,0,0,100)
    rect(WIDTH/2+dx,HEIGHT/2,WIDTH,HEIGHT)
    fill(255)
    text("<---  Swipe left",-WIDTH/2+dx,HEIGHT/2)
    
    fill(0,255,0,100)
    rect(-WIDTH/2+dx,HEIGHT/2,WIDTH,HEIGHT)
    fill(255)
    text("<---  Swipe right or left  --->",WIDTH/2+dx,HEIGHT/2)
    
    fill(255)
    text("Swipe right  --->",WIDTH+WIDTH/2+dx,HEIGHT/2)
    fill(0,0,255,100)
    rect(WIDTH+WIDTH/2+dx,HEIGHT/2,WIDTH,HEIGHT)
    
    if scroll then
        dx=dx+mv
        if dx>WIDTH then
            dx=WIDTH
            scroll=false
        end
        if dx<-WIDTH then
            dx=-WIDTH
            scroll=false
        end
        if dx>-20 and dx<20 then
            dx=0
            scroll=false
        end
    end
end

function touched(t)
    if t.state==MOVING then
        dx=dx+t.deltaX
        mv=t.deltaX
    end
    if t.state==ENDED then
        scroll=true
    end
end