Closed atmalik123 closed 2 years ago
The animation examples on the pythreejs docs have play/pause controls.
Is there a way to hide these controls and just have the animation play when the cell is run?
Here is the corresponding code from the docs:
from pythreejs import * import ipywidgets from IPython.display import display view_width = 600 view_height = 400 sphere = Mesh( SphereBufferGeometry(1, 32, 16), MeshBasicMaterial(color='red') ) cube = Mesh( BoxBufferGeometry(1, 1, 1), MeshBasicMaterial(color='green'), position=[2, 0, 4] ) camera = PerspectiveCamera( position=[10, 6, 10], aspect=view_width/view_height) position_track = VectorKeyframeTrack(name='.position', times=[0, 2, 5], values=[10, 6, 10, 6.3, 3.78, 6.3, -2.98, 0.84, 9.2, ]) rotation_track = QuaternionKeyframeTrack(name='.quaternion', times=[0, 2, 5], values=[-0.184, 0.375, 0.0762, 0.905, -0.184, 0.375, 0.0762, 0.905, -0.0430, -0.156, -0.00681, 0.987, ]) camera_clip = AnimationClip(tracks=[position_track, rotation_track]) camera_action = AnimationAction(AnimationMixer(camera), camera_clip, camera) scene = Scene(children=[sphere, cube, camera]) controller = OrbitControls(controlling=camera) renderer = Renderer(camera=camera, scene=scene, controls=[controller], width=view_width, height=view_height) renderer
You should be able to call the .play() function on the AnimationAction.
.play()
AnimationAction
Closing as answered.
The animation examples on the pythreejs docs have play/pause controls.
Is there a way to hide these controls and just have the animation play when the cell is run?
Here is the corresponding code from the docs: