rthreejs icon indicating copy to clipboard operation
rthreejs copied to clipboard

graphsjs() animation

Open JoGall opened this issue 8 years ago • 3 comments

Is there any way to animate globejs() without requiring interaction from the user? Perhaps by transitioning between frames with different latitude-longitude, similar to your animation example for graphjs? I'd love to be able to produce a visualisation of an auto-spinning globe.

Thanks for a great package by the way -- you've saved me 100s of hours learning D3.js from scratch!

JoGall avatar Jan 29 '18 15:01 JoGall

Sure, it seems like that would be do-able. I am much more focused on the development of graphjs these days, however and have not put in too much work on the globes (as you can see from the many outstanding bugs). A P.R. for this would certainly be appreciated and merged!

Other globejs() users might want this too, and be willing to collaborate...

bwlewis avatar Jan 31 '18 06:01 bwlewis

Just came back to this work and realised I forgot to reply -- thanks for your response.

I'd like to be able to contribute but know absolutely zero javascript and have no idea what's going on under the hood here. Could you perhaps point me in the right direction? Cheers!

JoGall avatar Feb 20 '18 16:02 JoGall

It's unfortunately a lot of JavaScript...the globejs JavaScript code is not very complicated (compared to scatterplot3js/graphjs). But part of that is because of the lack of fancy things like animation. Also the code is pretty old now and more of a prototype than the others.

But thinking about this, I'm not sure that the approach I used for graph animation is the right one for this. Instead, it might be easier to build a 3-d scene and load it, similar to what's done in this example:

https://threejs.org/examples/#webgl_animation_scene

The scene that is loaded is a complex json file describing the scene here: https://threejs.org/examples/#webgl_animation_scene

Then the task of the globejs function would be both simpler and more complex. First build the scene json specification (complex), then display it complete with whatever animation is in the scene (easy).

Note that, less the animation part, this is similar to the approach taken by the rgl package (https://cran.r-project.org/package=rgl).

This might also be a good way to support the objective in issue #77 -- it's a very different way of working than the current functions (which hard-code the various threejs objects like cameras, scenes, etc.) but could be very cool.

I will think about this some more...

bwlewis avatar Feb 23 '18 23:02 bwlewis