manishd_2000
manishd_2000

Reputation: 19

loading a new page after a short pause/delay using javascript

Am very new to javascript and am trying to simulate a simple animation where I want to load a html page which has the canvas that has some figures and then wait for 3 seconds and load another set of figures on top of the existing ones for it to look like a simuation. I have tried using the setTimeout but that just doesn't kick in after all the iterations are over. Was wondering if there is anything special that needs to be taken into account with canvas?

Thanks!

Upvotes: 2

Views: 102

Answers (2)

MrOnlineCoder
MrOnlineCoder

Reputation: 410

You can make a variable displayRects and do in draw function if (displayRects) { //draw rects }

And before on document load do

setTimeout(function(){displayRects = true},3000);

Upvotes: 1

Manu mahajan
Manu mahajan

Reputation: 21

You can use the following function of javascript

setTimeout(
  function() 
  {
    //do something special
  }, 3000);

In this 3000 is 3000 milliseconds , so can increase or decrease it.

Upvotes: 1

Related Questions