Skip to content
Darsain edited this page Apr 10, 2013 · 9 revisions

All default options are stored in the FPSMeter.defaults object. You can modify them simply by:

FPSMeter.defaults.graph = 1;

By default, everything except basic FPS display is disabled.

Quick reference

FPSMeter call with all default options as defined in the source.

var meter = new FPSMeter({
	interval:  100,     // Update interval in milliseconds.
	smoothing: 10,      // Spike smoothing strength. 1 means no smoothing.
	show:      'fps',   // Whether to show 'fps', or 'ms' = frame duration in milliseconds.
	toggleOn:  'click', // Toggle between show 'fps' and 'ms' on this event.
	decimals:  1,       // Number of decimals in FPS number. 1 = 59.9, 2 = 59.94, ...
	maxFps:    60,      // Max expected FPS value.
	threshold: 100,     // Minimal tick reporting interval in milliseconds.

	// Meter position
	position: 'absolute', // Meter position.
	zIndex:   10,         // Meter Z index.
	left:     '5px',      // Meter left offset.
	top:      '5px',      // Meter top offset.
	right:    'auto',     // Meter right offset.
	bottom:   'auto',     // Meter bottom offset.
	margin:   '0 0 0 0',  // Meter margin. Helps with centering the counter when left: 50%;

	// Theme
	theme: 'dark', // Meter theme. Build in: 'dark', 'light', 'transparent', 'colorful'.
	heat:  0,      // Allow themes to use coloring by FPS heat. 0 FPS = red, maxFps = green.

	// Graph
	graph:   0, // Whether to show history graph.
	history: 20 // How many history states to show in a graph.
});

Options


interval

Type: Integer Default: 100

Time in milliseconds specifying how often should the requestAnimationFrame that renders the meter state be called.

smoothing

Type: Integer Default: 1

When there are FPS or duration spikes, FPSMeter smooths them out. This specifies the smoothing strength. The higher this value is, the stronger the spikes smoothing gets, but also it takes longer to reflect the current FPS.

Minimum value is 1, which means instant representation of a current FPS frequency without smoothing.

Clone this wiki locally