TIZ
TIZ

Reputation: 11

d3.timer() frame - slowing down

is it possible to slow down frames in

d3.timer(function(){ alert("Hello"); }, 3000); ?

Here we have delay of 3 sec and then it becomes very fast.

For example in

setInterval(function(){ alert("Hello"); }, 3000);

we are able to change 3000 milliseconds to 2000 and we will be continuously alert every 2 sec instead of 3.

Thank you very much!

Upvotes: 1

Views: 221

Answers (1)

Bingo1392
Bingo1392

Reputation: 51

API reference of D3-timer says:

d3.interval(callback[, delay[, time]]) <>

Like timer, except the callback is invoked only every delay milliseconds; if delay is not specified, this is equivalent to timer. A suitable replacement for setInterval that is guaranteed to not run in the background. The callback is passed the elapsed time.

You can find it here: github

In your case:

d3.interval(function(){ alert("Hello") }, 3000);

Upvotes: 5

Related Questions