Changes between Version 4 and Version 5 of Examples/ParaviewAnimating
- Timestamp:
- 06/14/18 12:32:36 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Examples/ParaviewAnimating
v4 v5 4 4 https://www.paraview.org/ParaView3/Doc/Nightly/www/py-doc/paraview.servermanager_proxies.html 5 5 6 On this page, we would like to share our own experience with you. 6 On this page, we would like to share our own experience with you. DISCLAIMER: our knowlegde about all this is not complete and maybe incorrect. So believe everything found on this page on your own risk. 7 7 8 8 == ParaView Gui: Animation View == … … 14 14 15 15 == Basic Concept == 16 The basic concept of how to animate "something", in this case the rendered ParaView scene, is quite easy to understand. The central keyelement of any animation is a timeline with a start and end time and, as we work with discrete timesteps, a number of frames. This is implemented in the Python class paraview.simple.AnimationScene.16 The basic concept of how to animate "something", in this case the rendered ParaView scene, is quite easy to understand. The central element of any animation is a timeline with a start and end time and, as we work with discrete timesteps, a number of frames. This is implemented in the Python class paraview.simple.AnimationScene. 17 17 Within the time interval defined in the timeline, properties of the scene can be changed. 18 In the ParaView GUI this concept is reflected by so called "tracks" (or "cues") in the Animation View. Basically, each track defines the temporal change of one (or more) propert yof the scene.18 In the ParaView GUI this concept is reflected by so called "tracks" (or "cues") in the Animation View. Basically, each track defines the temporal change of one (or more) properties of the scene. 19 19 20 20 In ParaView-Python, different kinds (classes) of tracks/cues are available. Here we will try to explain four of them, which are implemented in the following Python classes: … … 26 26 The (change of the) values of the properties in the timeline are defined by one or more keyframes included in each track. The key elements :) of a keyframe are keytime and keyvalues. The value(s) of the referred property is set to the keyvalues at the specified keytime. Some types of keyframes also have the ability to interpolate keyvalues from one keyframe to the next. Specifically these are paraview.simple.CameraKeyFrame, paraview.simple.CompositeKeyFrame, paraview.simple.ExponentialKeyFrame, paraview.simple.RampKeyFrame and paraview.simple.SinusoidKeyFrame. 27 27 28 In the next paragraphs we are going to explain the basic mechanisms of the relevat Python classes and we give some examples of typical use cases. 28 29 30 == Class !AnimationScene == 31 The !AnimationScene is responsible for steering the animation clock time. 32 For this purpose, the !AnimationScene has a !StartTime, an !EndTime, and a mechanism to determine the discrete time steps it will generate between !StartTime and !EndTime. The descrete timesteps are determined by the Mode (called !PlayMode in Python) of the !AnimationScene. Three different Modes are avilable: 33 * 'Sequence': the timesteps are defined by the property !NumberOfFrames 34 * 'Snap To !TimeSteps': the descrete timesteps are defined by the timesteps available in the (time dependend) data. The !AnimationScene has knowledge about the available data timesteps by the help of a seperate object, the !TimeKeeper. 35 * '!RealTime': the timesteps are calculated on the fly (while rendering) to achieve a certain duration of the rendering. This mode is not useful for typical Python scripting, though. 36 37 Important properties of !AnimationScene: 38 * !StartTime: the start time of the animation 39 * !EndTime: the end time of the animation 40 * !PlayMode: either 'Sequence', 'Snap To !TimeSteps' or '!RealTime' 41 * !NumberOfFrames: number of frames, only used when !PlayMode is set to 'Sequence' 42 * !AnimationTime: the actual animation clock time. Can be get or set. 43 * !TimeKeeper: the !TimeKeeper-object 44 45 Important methods of !AnimationScene: 46 * !GoToFirst(): goto first frame 47 * !GoToLast(): goto last frame 48 * !GoToNext(): goto next frame 49 * !GoToPrevious(): goto previous frame 50 51 === Use Case === 52 Get the animation scene and play a sequence of 100 timesteps: 53 {{{ 54 #!python 55 animationScene = GetAnimationScene() 56 animationScene.StartTime = 0 57 animationScene.EndTime = 1 58 animationScene.NumberOfFrames = 100 59 animationScene.PlayMode = 'Sequence' 60 animationScene.GoToFirst() 61 while True: 62 # render scene 63 # safe image 64 if animationScene.AnimationTime == animationScene.EndTime: 65 break 66 anmationScene.GoToNext() 67 }}} 68 69 Get the animation scene and play all available timesteps of the time dependent data: 70 {{{ 71 #!python 72 animationScene = GetAnimationScene() 73 animationScene.PlayMode = 'Snap To TimeSteps' 74 animationScene.GoToFirst() 75 while True: 76 # render scene 77 # safe image 78 if animationScene.AnimationTime == animationScene.EndTime: 79 break 80 anmationScene.GoToNext() 81 }}} 82 83 84 85