There are four main different types of animations supported in Ceetron Desktop Components.
To ensure the best possible performance, all animations in Ceetron Desktop Components require the user to first setup the animation. Here all relevant data is loaded into the data source and the visual representation (display model) of the data is generated. This will ensure that once the animation is setup, it can run at the highest possible frame rate.
Below we describe how to setup these four forms of animations, and how to run and control the animation after it has been prepared.
Note: When setting up and running animations, it is very important that you have found an efficient way of representing your data in the data source. Please consult Efficient representation of your data for guidance on this topic.
If you are using a memory data source you will need to make sure that the DataSource has all the needed data before you setup the animation. If you are using a interface based data source (a custom data reader or a VTFx/ImportCae data source you can skip this step as Ceetron Desktop Components will automatically load the data needed.
Then you need to configure the ModelSpec with the results you would like to visualize.
For state animations, use the ModelSpec::setStateIds to specify all states in the order they should appear in the animation.
The call updateVisualization() to setup the animation.
For modeshape animations, use the ModelSpec::modeShapeAnimation() method to specify the settings for the mode shape animation you would like to generate.
The call updateVisualization() to setup the animation.
Setup the particle trace as you want it (see Particle traces for more info). There is no specific setup needed (e.g. number of frames) for particle traces. See the section below on how to run the animation.
Set up the cutting plane animation using a CuttingPlaneAnimation object. Specify number of frames and the distance should move per frame.
To run animations, you will need to use a timer. Timers are UI Toolkit and platform dependent, so please consult your UI Toolkit for tips on how to use timers. You need to create a timer that fires at least at the frequency you want your animation to run at. When the timer is called, you update the animation to set the next frame/particle trace time as shown below.
Please consult the DemoApp in the Examples folder (Examples/Qt/QtDemoApp/AnimationWidget.cpp) for a more complete example on how to handle both state and particle trace animations in your application.
Note: Do not call updateVisualization() before changing frames. updateVisualization() should only be called when setting up the animation, never when running it.
For state and modeshape animations you use the UnstructGridModel::setCurrentFrameIndex() method to specify which of the generated frames to show in the associated view.
So when the timer triggers, do the following for animations running forward.
As you are in control of setting the current animation frame, it is easy to do animation that runs backwards, bouncing (0..N-1..0..N-1) and any order you would like. You also decide when the animation frame changes if you want to synchronize the animation with other items or scaled real time.
To animate particle traces, you set the current particle trace time in the UnstructGridModel by using the setParticleTraceTime() method.