Interface Controls and CPU Use

Version 0.3.0 of the threejs package uses https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TrackballControls.js by default for smooth mouse and touch interactivity. But the package uses it in a way that consumes some CPU cycles whenever a threejs visualization is visible.

Alternatively, try setting the use.orbitcontrols=TRUE option to switch to a variation of https://github.com/mrdoob/three.js/blob/master/examples/js/controls/OrbitControls.js modified to work with the threejs package to suspend animation when there is no plot interaction, saving CPU cycles and laptop batteries.

suppressMessages({
library(crosstalk)
library(htmltools)
library(threejs)})

data(LeMis)
p = graphjs(LeMis, width=400)
q = graphjs(LeMis, use.orbitcontrols=TRUE, width=400)

bscols(tags$div(list(tags$h3("Default controls"), p)), tags$div(list(tags$h3("Power-saving controls"), q)))

Default controls

Power-saving controls

The modified OrbitControls are not as responsive as the default TrackballControls, and they limit y-axis rotation. But using the modified OrbitControls helps the threejs package go easy on your battery.