I am making a game using html canvas in which i want to check for certain condition every time in animate loop and if that condition become true once then I don't want to check for next 3 seconds and after 3 seconds i want to check again. Like
function animate(){
requestAnimationFrame(animate)
if (checking something){
if this if statement gets executed then don't check this if statement for next 3 seconds
}
This might sound bit confusing but is there anyway to do this.