
#########
Animation
#########

.. js:class:: cee.ug.Animation

   Handles animation of a :js:class:`RemoteModel <cee.ug.RemoteModel>`\ .
   
   With this class you can control state animations (animations across the states of the CAE analysis), particle trace animations and mode shape animations.
   
   To start a state animation, specify the states to animate over with the :js:func:`ModelSpec.stateIdArray <cee.ug.ModelSpec.stateIdArray>` property and call :js:meth:`runAnimation(true) <cee.ug.Animation.runAnimation>`\ .
   
   To start a particle trace animation, set the :js:func:`particleTraceAnimationStepCount <cee.ug.Animation.particleTraceAnimationStepCount>` property and call :js:meth:`runParticleTraceAnimation(true) <cee.ug.Animation.runParticleTraceAnimation>`\ . Note that you must first create a particle trace by calling :js:meth:`RemoteModel.addParticleTraceGroup <cee.ug.RemoteModel.addParticleTraceGroup>`\ .
   
   To start a mode shape animation, set the :js:func:`ModelSpec.modeShapeAnimationType <cee.ug.ModelSpec.modeShapeAnimationType>` and :js:func:`ModelSpec.modeShapeFrameCount <cee.ug.ModelSpec.modeShapeFrameCount>` properties and then call :js:meth:`runAnimation(true) <cee.ug.Animation.runAnimation>`\ . Note that you must first set a displacement result on the model with :js:func:`ModelSpec.displacementResultId <cee.ug.ModelSpec.displacementResultId>`\ , and that :js:func:`ModelSpec.stateIdArray <cee.ug.ModelSpec.stateIdArray>` must contain exactly one state id.
   
   You can access the animation object from the remote model with the :js:func:`RemoteModel.animation <cee.ug.RemoteModel.animation>` property.
   
   
   Index
   =====
   
   .. rubric:: Accessors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.ug.Animation.particleTraceAnimationStepCount`
   * :js:func:`~cee.ug.Animation.targetFrameRate`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~cee.ug.Animation.isAnyAnimationRunning`
   * :js:meth:`~cee.ug.Animation.isModelAnimationRunning`
   * :js:meth:`~cee.ug.Animation.runAnimation`
   * :js:meth:`~cee.ug.Animation.runParticleTraceAnimation`
   * :js:meth:`~cee.ug.Animation.setAnimationFrameChangedCallback`
   * :js:meth:`~cee.ug.Animation.setFirstFrame`
   * :js:meth:`~cee.ug.Animation.setLastFrame`
   * :js:meth:`~cee.ug.Animation.setNextFrame`
   * :js:meth:`~cee.ug.Animation.setPreviousFrame`
   
   



.. rst-class:: kind-group kind-accessors

.. rubric:: Accessors
   :class: kind-group-title


.. js:method:: cee.ug.Animation.particleTraceAnimationStepCount

      .. rst-class:: sig-pretty-signature
      
         | *get* particleTraceAnimationStepCount(): *number*
      
      The number of steps to use for the particle trace animation.
      
      The number of steps will be used to calculate the delta time for each step in the animation based on the total time of all active traces.
      
      **Returns**\ : *number*
      
      .. rst-class:: sig-pretty-signature
      
         | *set* particleTraceAnimationStepCount(**numSteps**\ : *number*\ ): *void*
      
      **Parameters**
      
      
         **numSteps**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.targetFrameRate

      .. rst-class:: sig-pretty-signature
      
         | *get* targetFrameRate(): *number*
      
      The target animation speed in frames per second (fps).
      
      This will be the maximum animation speed, but the actual speed may be lower for large models or slow clients.
      
      **Returns**\ : *number*
      
      .. rst-class:: sig-pretty-signature
      
         | *set* targetFrameRate(**framesPerSecond**\ : *number*\ ): *void*
      
      **Parameters**
      
      
         **framesPerSecond**\ : *number*
      
      
      **Returns**\ : *void*
      



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: cee.ug.Animation.isAnyAnimationRunning

      .. rst-class:: sig-pretty-signature
      
         | isAnyAnimationRunning(): *boolean*
      
      Returns true if either a state, mode shape or particle trace animation is running
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.ug.Animation.isModelAnimationRunning

      .. rst-class:: sig-pretty-signature
      
         | isModelAnimationRunning(): *boolean*
      
      Returns true if either a state or mode shape animation is running
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.ug.Animation.runAnimation

      .. rst-class:: sig-pretty-signature
      
         | runAnimation(**run**\ : *boolean*\ ): *void*
      
      Starts a state (transient) or mode shape animation.
      
      The steps are configured in the :js:class:`ModelSpec <cee.ug.ModelSpec>` of the :js:class:`RemoteModel <cee.ug.RemoteModel>`\ .
      
      To start a state (transient) animations, set the states you would like to animate over with :js:func:`ModelSpec.stateIdArray <cee.ug.ModelSpec.stateIdArray>`\ . The order of the states in the animation will be the same as in the array. Note that :js:func:`ModelSpec.modeShapeFrameCount <cee.ug.ModelSpec.modeShapeFrameCount>` MUST be set to 0 for state (transient) animations.
      
      To start a mode shape animation, set the :js:func:`ModelSpec.modeShapeAnimationType <cee.ug.ModelSpec.modeShapeAnimationType>` and :js:func:`ModelSpec.modeShapeFrameCount <cee.ug.ModelSpec.modeShapeFrameCount>` properties and then call :js:meth:`runAnimation(true) <cee.ug.Animation.runAnimation>`\ . Note that you must first set a displacement result on the model with :js:func:`ModelSpec.displacementResultId <cee.ug.ModelSpec.displacementResultId>`\ , and that :js:func:`ModelSpec.stateIdArray <cee.ug.ModelSpec.stateIdArray>` must contain exactly one state id.
      
      **Parameters**
      
      
         **run**\ : *boolean*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.runParticleTraceAnimation

      .. rst-class:: sig-pretty-signature
      
         | runParticleTraceAnimation(**run**\ : *boolean*\ ): *void*
      
      Starts a particle trace animation.
      
      The number of steps to use for the animation can be set with :js:func:`particleTraceAnimationStepCount <cee.ug.Animation.particleTraceAnimationStepCount>`\ .
      
      **Parameters**
      
      
         **run**\ : *boolean*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.setAnimationFrameChangedCallback

      .. rst-class:: sig-pretty-signature
      
         | setAnimationFrameChangedCallback(**animationFrameChangedCallback**\ : :js:class:`AnimationFrameChangedCallback <cee.ug.AnimationFrameChangedCallback>`\ ): *void*
      
      Sets a handler function that will be called whenever a progress indication packet is received from the visualization server.
      
      **Parameters**
      
      
         **animationFrameChangedCallback**\ : :js:class:`AnimationFrameChangedCallback <cee.ug.AnimationFrameChangedCallback>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.setFirstFrame

      .. rst-class:: sig-pretty-signature
      
         | setFirstFrame(): *void*
      
      Sets the first step of the animation (if any) as the current step. This will stop the animation.
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.setLastFrame

      .. rst-class:: sig-pretty-signature
      
         | setLastFrame(): *void*
      
      Sets the last step of the animation (if any) as the current step. This will stop the animation.
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.setNextFrame

      .. rst-class:: sig-pretty-signature
      
         | setNextFrame(): *void*
      
      Sets the next step of the animation (if any) as the current step, wrapping around to the first step if on the last step. This will stop the animation.
      
      **Returns**\ : *void*
      



.. js:method:: cee.ug.Animation.setPreviousFrame

      .. rst-class:: sig-pretty-signature
      
         | setPreviousFrame(): *void*
      
      Sets the previous step of the animation (if any) as the current step, wrapping around to the last step if on the first step. This will stop the animation.
      
      **Returns**\ : *void*
      




