-
Notifications
You must be signed in to change notification settings - Fork 194
Description
Hi,
I have two Meshes and two AnimationActions. I would like to have a single animation control widget to control both animations/objects. How is this possible?
I guess something like syncWith() in Three js could be done.
Thanks!
`
from pythreejs import *
scene = Scene()
scene.add(AmbientLight())
camera = PerspectiveCamera(position=[5,5,5])
scene.add(SpotLight(position=[5,5,0]))
renderer = Renderer(scene=scene, camera=camera, controls=[OrbitControls(controlling=camera)])
renderer
box1 = Mesh(geometry=BoxBufferGeometry(), material=MeshStandardMaterial(color='red'))
scene.add(box1)
box2 = Mesh(geometry=BoxBufferGeometry(), material=MeshStandardMaterial(color='blue'), position=[0,0,2])
scene.add(box2)
track1 = NumberKeyframeTrack(name='.rotation[z]', times=[0,1], values=[0,1])
clip1 = AnimationClip(tracks=[track1])
animation1 = AnimationAction(mixer=AnimationMixer(), clip=clip1, localRoot=box1)
animation1
track2 = NumberKeyframeTrack(name='.position[y]', times=[0,1], values=[0,-0.5])
clip2 = AnimationClip(tracks=[track2])
animation2 = AnimationAction(mixer=AnimationMixer(), clip=clip2, localRoot=box2)
animation2
animation1.play()
animation2.play()
`