BasicAnimator
vmm3d.core

Class BasicAnimator

  • All Implemented Interfaces:
    Animation


    public class BasicAnimatorextends TimerAnimation
    A BasicAnimator can animate one or more Animateable objects. It is a fairly simple extension of TimerAnimation that keeps a list of Animateable items and in each frame calls each item's Animateable.setFractionComplete(double) method. In fact, all Animateable objects in the vmm core are Animateable Parameters such as RealParamAnimateable, and BasicAnimators are used only for Morphing animations.

    It is also possible to add a RealParamAnimateable or ComplexParamAnimateable with specified start and end values, which will be used instead of the start and end values stored in the parameter itself.

    • Constructor Detail

      • BasicAnimator

        public BasicAnimator()
        Create a BasicAnimator with no items, with 100 frames and 50 millseconds per frame. Animated items can be added with the addAnimatedItem method.
      • BasicAnimator

        public BasicAnimator(int frames)
        Create a BasicAnimator with no items, with a specified number of frames, and with 50 millisconds. Animated items can be added with the addAnimatedItem method.
      • BasicAnimator

        public BasicAnimator(Animateable item)
        Create a BasicAnimator with one Animateable item, with 100 frames and 50 millseconds per frame. More animated items could be added with the addAnimatedItem method.
        Parameters:
        item - An item to be animated by this animation. Can be null, in which case the animation has no items initially.
      • BasicAnimator

        public BasicAnimator(Animateable item,             int frames,             int millisecondsPerFrame)
        Create a BasicAnimator with one item, with a specified number of frames and delay per frame. More animated items could be added with the addAnimatedItem method.
        Parameters:
        item - An item to be animated by this animation. Can be null, in which case the animation has no items initially.
        frames - The number of frames in the animation
        millisecondsPerFrame - The desired number of milliseconds for each frame
      • BasicAnimator

        public BasicAnimator(Animateable[] items,             int frames,             int millisecondsPerFrame)
        Create a BasicAnimator with several animated itemss, and with a specified number of frames and delay per frame.
        Parameters:
        items - An array of items to be animated by this animation. Can be null, in which case the animation has no items initially.
        frames - The number of frames in the animation.
        millisecondsPerFrame - The desired number of milliseconds for each frame
    • Method Detail

      • setRestoreParameterValues

        public void setRestoreParameterValues(boolean restoreParameterValues)
        Set the restoreParameterValues property. If this property is true, then this BasicAnimator will save the value of any Parameter among its Animateable objects at the beginning of the animation, and it will restore those values when the animation ends. The default value is true. The value must be set before the animation is started for it to have any effect.
      • addAnimatedItem

        public void addAnimatedItem(Animateable item)
        Add an Animateable item to the list of items that change during this animation.
        Parameters:
        item - The item to be added. If null, nothing is done.
      • addWithCustomValue

        public void addWithCustomValue(IntegerParam item,                      int value)
        Adds an IntegerParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.
        Parameters:
        item - the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.
      • addWithCustomValue

        public void addWithCustomValue(RealParam item,                      double value)
        Adds a RealParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.
        Parameters:
        item - the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.
      • addWithCustomValue

        public void addWithCustomValue(ComplexParam item,                      Complex value)
        Adds a ComplexParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.
        Parameters:
        item - the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.
        value - the value for the parameter. If this is null, 0 is used.
      • addWithCustomLimits

        public void addWithCustomLimits(RealParamAnimateable item,                       double start,                       double end)
        Adds a RealParamAniamteable to this animator, with specified start and end values for the animation. These values are used instead of the start and end values stored in the parameter itself, and those values are not modified by the animation. (This is meant to allow, for example, the creation of "custom morphs" in addition to the standard Morph and Cyclic Morph, which always use the start and end values specified by the user and stored in the parameters.)
        Parameters:
        item - the parameter to be animated. If this is null, nothing is done and no error occurs.
      • addWithCustomLimits

        public void addWithCustomLimits(ComplexParamAnimateable item,                       Complex start,                       Complex end)
        Adds a ComplexParamAniamteable to this animator, with specified start and end values for the animation. These values are used instead of the start and end values stored in the parameter itself, and those values are not modified by the animation. If the start or end value is null, 0 is used.
        Parameters:
        item - the parameter to be animated. If this is null, nothing is done and no error occurs.
      • start

        public final void start()
        Description copied from class: TimerAnimation
        Starts the animation running. An animation does not start running automatically, but only when this method is called. If the animation is already runnning, this has no effect. If the animation has already run and has finished for any reason, it is restarted from the beginning.
        Specified by:
        start in interface Animation
        Overrides:
        start in class TimerAnimation
      • cancel

        public final void cancel()
        Description copied from class: TimerAnimation
        Cancels a running animation. If this animation is not running, this has no effect.
        Specified by:
        cancel in interface Animation
        Overrides:
        cancel in class TimerAnimation
      • getStatusText

        public String getStatusText(boolean running)
        Returns null to indicate that the default text ("Animation Running" or "Animation Paused" in the English version) should be shown in the display's status bar. This can be overridden in a subclass to show a different status message.
        Specified by:
        getStatusText in interface Animation
        Overrides:
        getStatusText in class TimerAnimation
        Parameters:
        running - tells whether the animation is currently running.
        Returns:
        the text to displayed, or null to use the default text "Animation Running" or "Animation Paused"

SCaVis 2.2 © jWork.ORG