Camera Zoom - A tiny toy

Yesterday, I was playing with the new features of Codea.

I made a little experiment called Camera Zoom.

Simply, press and hold to increase the image size.

Here is the code:

zoom = false
size = 500

function setup()
    displayMode(FULLSCREEN)
    cameraSource(CAMERA_BACK)
end

function draw()
    local camWidth, camHeight = spriteSize( CAMERA )
    sprite( CAMERA, WIDTH/2, HEIGHT/2, math.min( camWidth+size, WIDTH+size ) )
    
    if zoom == true then
        if size == 4000 then
            size = 4000
        else
            size = size + 100
        end
    end
    
    if zoom == false then
        if size == 500 then
            size = 500
        else
            size = size - 100
        end
    end
end

function touched(touch)
    if touch.state == BEGAN then
        zoom = true
    end
    
    if touch.state == ENDED then
        zoom = false
    end
end