jupyter-widgets / pythreejs

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

autoplay in exported html? #404

Open nikhilmishra000 opened 11 months ago

nikhilmishra000 commented 11 months ago

I have a scene that I'm saving to a static html page:

scene = pythreejs.Scene(...)
renderer = pythreejs.Renderer(scene=scene, ...)
clip = pythreejs.AnimationClip(tracks=...)
mixer = pythreejs.AnimationMixer(...)
action = pythreejs.AnimationAction(mixer, clip, scene)
page = ipywidgets.VBox([renderer, action])

ipywidgets.embed.embed_minimal_html(
    "export.html",
    views=page,
    title="Animation",
    state=ipywidgets.embed.dependency_state([page]),
)

and the buttons from the AnimationAction work as expected in the html page.

Is there way to construct the widgets such that the animation automatically plays (without needing to hit the play button)? I saw this issue about calling AnimationAction.play() inside a notebook, but that doesn't seem like it persists in the widget state that gets exported...