bwlewis / rthreejs

Three.js widgets for R and shiny
http://bwlewis.github.io/rthreejs
Other
303 stars 64 forks source link

auto rotation in globejs() #86

Open EmilHvitfeldt opened 5 years ago

EmilHvitfeldt commented 5 years ago

Just stumbled across this package and it is fantastic!

The globejs() function is amazing, but I would like to know if it is able to activate auto rotation? I found the following line

https://github.com/bwlewis/rthreejs/blob/84e42dac4f6ffb37b46cc5597eea57c8ec34b9d0/inst/htmlwidgets/lib/threejs-85/StateOrbitControls.js#L70

but I don't see a way to access the variables from globejs().

bwlewis commented 5 years ago

Someone once tried to add this but I never heard back about it.

As you point out, it looks like it might be as easy as surfacing the OrbitControls.js autoRotate up to the R function...I'll try to do that and let you know.

gryslik commented 5 years ago

I am interested in this as well. Has there been any progress on this?

bwlewis commented 4 years ago

Sorry about the long latency. Despite an imminent new version this is still not in there. The globe.js low-level code does not use THREE.StateOrbitControls suggested by @EmilHvitfeldt at all unfortunately. That could would need to be re-written to use that, or alternatively an auto rotation added to the bespoke scheme in use now. (The use.orbitcontrols=TRUE option is only avilable, experimentally, in scatterplot3js and graphjs).

bwlewis commented 4 years ago

Yeah, looking at this it would be easier to leave the JS more or less as is and add a new option for constant rotation. It would be something like an animate() function callback that updates the rotation just like the el.onmousemove function does, but then periodically calls render() after some small timeout.

Anybody feel like implementing this?

aw236 commented 2 years ago

would love this feature as well.