ParaView/Python/Animation: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Replaced content with "== Animating time series == {{ParaView/Template/DeprecatedUsersGuide}} {{ParaView/Template/Footer}}")
Tag: Replaced
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
== Animating time series ==
== Animating time series ==
Server Manager has a complicated animation engine based on keyframes and scenes. This section will introduce a few simple ways of animating your visualization.
{{ParaView/Template/DeprecatedUsersGuide}}
If you have a time-aware reader, you can animate it with AnimateReader().
{{ParaView/Template/Footer}}
 
<source lang="python">
reader = ExodusIIReader(“.../can.ex2”)
Show(reader)
Render()
c = GetActiveCamera()
c.Elevation(95)
# Animate over all time steps. Note that we are not passing the optional
# 3rd argument here. If you pass a filename as the 3rd argument,
# AnimateReader will create a movie.
AnimateReader(reader)
# Save the animation to an avi file
AnimateReader(reader, filename=".../movie.avi")
</source>
 
== Animating properties ==
To animate properties other than time, you can use regular keyframes.
 
<source lang="python">
Sphere()
Show()
Render()
 
# Create an animation scene
scene = servermanager.animation.AnimationScene()
# Add one view
scene.ViewModules = [GetActiveView()]
 
# Create a cue to animate the StartTheta property
cue = servermanager.animation.KeyFrameAnimationCue()
cue.AnimatedProxy = GetActiveSource()
cue.AnimatedPropertyName = "StartTheta"
# Add it to the scene's cues
scene.Cues = [cue]
 
# Create 2 keyframes for the StartTheta track
keyf0 = servermanager.animation.CompositeKeyFrame()
keyf0.Interpolation = 'Ramp'
# At time = 0, value = 0
keyf0.KeyTime = 0
keyf0.KeyValues= [0]
 
keyf1 = servermanager.animation.CompositeKeyFrame()
# At time = 1.0, value = 200
keyf1.KeyTime = 1.0
keyf1.KeyValues= [200]
 
# Add keyframes.
cue.KeyFrames = [keyf0, keyf1]
 
scene.Play()
 
# Some properties you can change
#
# Number of frames used in Sequence mode
# scene.NumberOfFrames = 100
#
# Or you can use real time mode
# scene.PlayMode = 'Real Time'
# scene.Duration = 20
</source>

Latest revision as of 18:53, 24 June 2024

Animating time series

PAGE DELETED
The Paraview's User Guide and Reference Manual have been moved from the Wiki to The ParaView Guide. Please use the history if you want to access the old version of this document.



ParaView: [Welcome | Site Map]