Skip to content

mixed/requestAnimationFrameInterval

Repository files navigation

requestAnimationFrameInterval

requestAnimationFrameInterval is interval excute callback using requestAnimationFrame.

Why should I use it?

If you use repeatedly requestAnimationFrame then inconvenient.

// sample
var key = requestAnimationFrame(function loop(){
	// Do something

	key = requestAnimtionFrame(loop);
});

// stop requestAnimationFrame
cancelAnimationFrame(key);

So, I make requestAnimationFrameInterval. It is similar setInterval. Very Simple. and You make readable code more.

// sample
var key = requestAnimationFrameInterval(function(timestamp, count){
	// Do something
});

// stop requestAnimationFrameInterval
cancelAnimationFrameInterval(key);

Install

bower install requestAnimationFrameInterval

In your web page:

<script src="[path_to_dist]/rafi.js>"></script>

API

window.requestAnimationFrameInterval(function callback(timestamp, count){
	
});

callback

timestamp count
DOMHighResTimeStamp callcount

About

Interval excute callback using requestAnimationFrame

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published