该维基例子看起来有些过时。
试试这个在脚本:
# get active source.
sphere1 = GetActiveSource()
# get animation track
sphere1StartThetaTrack = GetAnimationTrack('StartTheta', index=0, proxy=sphere1)
# create keyframes for this animation track
# create a key frame
keyFrame1 = CompositeKeyFrame()
# create a key frame
keyFrame2 = CompositeKeyFrame()
keyFrame2.KeyTime = 1.0
keyFrame2.KeyValues = [360.0]
# initialize the animation track
sphere1StartThetaTrack.KeyFrames = [keyFrame1, keyFrame2]
# get animation scene
animationScene = GetAnimationScene()
animationScene.Play()
你应该能够与可视化互动,而动画运行并启动它或与动画控件停止它。
请注意,我使用ParaView的Python跟踪功能来达到此代码示例。
顺便说一下,在动画过程中的某个时候是否可以嵌入对象创建,或者它们都应该在动画开始之前预先创建? – DuckQueen
我不知道如何在动画过程中创建对象 - 最好在动画之前创建它们。 –