Stats.js Interface - getStatsObject()

优质
小牛编辑
127浏览
2023-12-01

Get the reference of Stats.js panel object, after getting the panel, it is possible to customize the panel
style(for example, change panel's position). Checkout Stats's
github repo
for more information about its panel.


for change panel position

Default Stats panel's position is top-left

Code Example: (change the Stats panel's position to top-right)

// use getStatsObject API to get the reference after initialized
statsObject = controller.getStatsObject();

// change the panel's position to top-right
statsObject.dom.style.left = null;
statsObject.dom.style.right = 0;