Skip to content

Frame.js

Danny Garcia edited this page Sep 29, 2012 · 2 revisions

Frame.js is a simple polyfill for window.requestAnimationFrame.

Quick Start

JavaScript

// Standard
(function () {

	var frame = new fil.Frame();

	frame.start(); // starts requestAnimationFrame

	// Animation Frame
	frame.step = function (f) {
		// Do cool things with animations here.
	};

	window.setTimeout(function () {
		frame.stop(); // stops requestAnimationFrame
	}, 5000);

}());

// AMD
require(["Frame"], function (Frame) {

	var frame = new fil.Frame();

	frame.start(); // starts requestAnimationFrame

	// Animation Frame
	frame.step = function (f) {
		// Do cool things with animations here.
	};

	window.setTimeout(function () {
		frame.stop(); // stops requestAnimationFrame
	}, 5000);

});
Clone this wiki locally