Parallax moving image demo

Simple demo. Tilt and rotate the iPad to give a sense of depth. Inspired by this tweet from Jarom Vogel https://twitter.com/jaromvogel/status/1026464183380992001?s=21

-- Moving Image
-- by West

displayMode(FULLSCREEN)
function setup()
    
    x=WIDTH/2
    y=HEIGHT/2
    x2=WIDTH/2
    y2=HEIGHT/2
    fg=image(WIDTH,HEIGHT)
    setContext(fg)
    for i=-100,WIDTH+100,200 do
        sprite("Cargo Bot:Title Large Crate 1",i,50,200,200)
        if math.random(3)==1 then
            sprite("Cargo Bot:Title Large Crate 2",i,250,200,200)
        end
    end
    sprite("Cargo Bot:Codea Logo",WIDTH/2,HEIGHT*0.7)
    setContext()
end

function draw()
    
    x=x-RotationRate.y/2
    y=y+RotationRate.x/2
    x2=x2-RotationRate.y
    y2=y2+RotationRate.x
    sprite("Environments:Sunny Front",x2,y2,WIDTH*1.2,HEIGHT*1.2)
    sprite("Cargo Bot:Opening Crates",x,y,WIDTH*1.1,HEIGHT*1.1)
    sprite(fg,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
end


@West Nice demo.