jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

Updates to KeyframeTrack do not effect the AnimationAction #175

Open maartenbreddels opened 6 years ago

maartenbreddels commented 6 years ago

Starting from this example and afterwards executing this:

positon_track.values = [100, 6, 100,
            6.3, 3.78, 6.3,
            -2.98, 0.84, 9.2,
           ]

will not lead to different positions in the animation, it keeps the old ones. Any idea?

vidartf commented 6 years ago

Thanks for this. It seems the values array cannot be reassigned on the JS side; it needs to be written to in-place (i.e. same array, new content).

vidartf commented 6 years ago

Note, this might mean that you cannot change the length of times/values during the run-time. I'll look further into it. What is the usage pattern for what you are doing?

maartenbreddels commented 6 years ago

Ok, i worked around it by creating the whole widgets-chain again. Also, it would be nice if the AnimationAction can reuse the Play view, and be controlled programatically.

maartenbreddels commented 6 years ago

I'm making a movie creator, so you click a button, and it should add the position and camera quaternion to a list to edit the camera keyframe positions and angles.

vidartf commented 6 years ago

Neat. Is the logic kernel side or front-end side (just curious)? Can you say a little more what what you mean about the AnimationAction thing?

I'm considering marking the times/values as read only on the kernel side (i.e. can only be passed in constructor). What do you think?

maartenbreddels commented 6 years ago

http://pythreejs.readthedocs.io/en/latest/api/animation/AnimationAction_autogen.html There is some bookkeeping doing on at the server side, but if we would have a widget + jslink that could add/remove/set values of a list, I think it could go all server side. However, the threejs animation framework doesn't play nice with the rest of ipywidgets, I wonder if ipytween should be started... :) On that last item, that would prevent doing it all front-end, but if it's not possible.. so be it.

vidartf commented 6 years ago

Would you mind specifying the use cases you encounter where using the animation system is difficult? It would be nice to have a list of cases, so that we can either develop solutions for it, or list workarounds.

maartenbreddels commented 6 years ago

Issues I remember now: