rthreejs icon indicating copy to clipboard operation
rthreejs copied to clipboard

auto rotation in globejs()

Open EmilHvitfeldt opened this issue 5 years ago • 5 comments

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().

EmilHvitfeldt avatar Mar 21 '19 21:03 EmilHvitfeldt

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.

bwlewis avatar Mar 23 '19 20:03 bwlewis

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

gryslik avatar Jul 26 '19 14:07 gryslik

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 avatar Jan 20 '20 22:01 bwlewis

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?

bwlewis avatar Jan 20 '20 22:01 bwlewis

would love this feature as well.

aw236 avatar Dec 11 '21 04:12 aw236