Lock frame rate

Hi guys. I was wondering if it’s possible to lock the framerate in Codea to be less than 60. Can I manipulate the draw function to make it work at 30 or 20 fps?

The draw function will run at 60 FPS no matter what you do, but you can skip drawing any time you want. So you could only draw every second or third frame, if you chose.

This means you can reduce the frame rate by any factor that divides into 60, ie 2 and 3.

Bear in mind, though, that if your app is running below 60 FPS, say 50 FPS, and you only draw every second frame, you will be drawing at 25 FPS, ie half the current speed.

@Ignatz thanks for the answers. So this means that it’s not possible to continuously draw a circle without skipping frames at 30 fps?

@the_dude this program will let you specify the frame rate you want


--# Main
-- myRate
backingMode(RETAINED)

function setup()
    FPS = 10
    paint()
end

function paint()
    background(40, 40, 50)
    strokeWidth(5)
    rect(ElapsedTime*100,300,50,50)
    
    -- this will do the frame rate
    tween.delay(1/FPS,paint)
end

@Jmv38 thanks, man