FpsGraph
A control for monitoring and graphing frame rates over time.
Integrates the FPS Graph control from Tweakpane-creator Hiroki Kokubun's Essentials plugin.
By default, the component creates an internal requestAnimationFrame
loop to measure the overall performance of the page. If you want to measure the performance of a specific block of code, you can bind the begin
and end
props for access to functions to fence the code of interest. (The default internal loop will be cleaned up automatically on the bound functions first use.)
See the <Profiler>
component for a more advanced measurement and visualization strategies.
If you'd like to observe or visualize the frame rate data elsewhere, a change
event is provided to notify when the FPS value changes.
Usage outside of a <Pane>
component will implicitly wrap the FPS graph in <Pane position="inline">
.
Note that Svelte Tweakpane UI embeds a functionally identical fork of the plugin with build optimizations. The fork also changes the package name from @tweakpane/plugin-essentials
to @kitschpatrol/tweakpane-plugin-essentials
for consistency with other plugins.
optional | |
Description | Function to start a single frame measurement sample. If undefined, a |
---|---|
Type | ((() => void) & (() => void)) |
Default | undefined |
optional | |
Description | Function to end a single frame measurement sample. If undefined, a |
---|---|
Type | ((() => void) & (() => void)) |
Default | undefined |
optional | |
Description | Lower bound of the FPS graph. |
---|---|
Type | number |
Default | 0 |
optional | |
Description | Upper bound of the FPS graph. |
---|---|
Type | number |
Default | 90 |
optional | |
Description | Time in milliseconds between updates to the graph. |
---|---|
Type | number |
Default | 1000 |
optional | |
Description | Text displayed next to the FPS graph. |
---|---|
Type | string |
Default | undefined |
optional | |
Description | Height of the FPS graph, in rows. |
---|---|
Type | number |
Default | 2 |
optional | |
Description | Prevent interactivity and gray out the control. |
---|---|
Type | boolean |
Default | false |
optional | |
Description | Custom color scheme. |
---|---|
Type | Theme |
Default | undefined Inherits default Tweakpane theme equivalent to ThemeUtils.presets.standard , or the theme set with setGlobalDefaultTheme() . |
Description | Fires when the FPS value changes, passing the latest FPS measurement. Note that the values described in the |
---|---|
Type | FpsGraphChangeEvent |