Class BasicTextAnimation

    • Field Detail

      • text

        private final java.lang.String text
      • offsetEnabled

        private boolean offsetEnabled
    • Constructor Detail

      • BasicTextAnimation

        public BasicTextAnimation​(BasicTextLabel label,
                                  long duration,
                                  java.lang.String text,
                                  AnimationFunction<java.awt.Color> colorFunction,
                                  AnimationFunction<java.lang.Float> scaleXFunction,
                                  AnimationFunction<java.lang.Float> scaleYFunction,
                                  AnimationFunction<java.lang.Float> spaceFunction)
        Constructs a text animation that fades in a text, scales it and fades it out. Uses the given color and scaling functions.
        Parameters:
        label - the animation target component
        duration - the animation duration
        text - the text to fade in
        colorFunction - the animation function for the color
        scaleXFunction - the animation function for the horizontal scale
        scaleYFunction - the animation function for the vertical scale
        spaceFunction - the animation function for the glyph space
    • Method Detail

      • defaultFade

        public static BasicTextAnimation defaultFade​(BasicTextLabel label,
                                                     long duration,
                                                     java.lang.String text,
                                                     java.awt.Color baseColor)
        Creates and returns an animation for a text fade-in and -out.
        Parameters:
        label - the animation target component
        duration - the animation duration
        text - the text to fade in
        baseColor - the base color for the fade effect
        Returns:
        an animation with a default text fade
      • defaultScale

        public static BasicTextAnimation defaultScale​(BasicTextLabel label,
                                                      long duration,
                                                      java.lang.String text,
                                                      java.awt.Color baseColor)
        Creates and answers an animation, that provides a text fade-in and -out and scales the text while fading out.
        Parameters:
        label - the animation target component
        duration - the animation duration
        text - the text to fade in
        baseColor - the base color for the fade effect
        Returns:
        an animation with a default scaling text effect
      • defaultSpace

        public static BasicTextAnimation defaultSpace​(BasicTextLabel label,
                                                      long duration,
                                                      java.lang.String text,
                                                      java.awt.Color baseColor)
        Creates and answers an animation, that provides a text fade-in and -out and increases the glyph spacing.
        Parameters:
        label - the animation target component
        duration - the animation duration
        text - the text to fade in
        baseColor - the base color for the fade effect
        Returns:
        an animation with a default glyph spacing effect
      • defaultFadeColorFunction

        public static AnimationFunction<java.awt.Color> defaultFadeColorFunction​(long duration,
                                                                                 java.awt.Color baseColor)
        Creates and returns the color animation function for the default fade.
        Parameters:
        duration - the animation duration
        baseColor - the base color for the fade effect
        Returns:
        a Color-valued animation function for the default fade
      • cinemaFadeColorFunction

        public static AnimationFunction<java.awt.Color> cinemaFadeColorFunction​(long duration,
                                                                                java.awt.Color baseColor)
        Creates and returns the color animation function for the default fade.
        Parameters:
        duration - the animation duration
        baseColor - the base color for the fade effect
        Returns:
        a Color-valued animation function for the default fade
      • defaultScaleColorFunction

        public static AnimationFunction<java.awt.Color> defaultScaleColorFunction​(long duration,
                                                                                  java.awt.Color baseColor)
        Creates and returns the animation function for the default scaling.
        Parameters:
        duration - the animation duration
        baseColor - the base color for the fade effect
        Returns:
        a Color-valued animation function for the default scaling
      • defaultSpaceColorFunction

        public static AnimationFunction<java.awt.Color> defaultSpaceColorFunction​(long duration,
                                                                                  java.awt.Color baseColor)
        Creates and answers the color animation function for the default spacing animation.
        Parameters:
        duration - the animation duration
        baseColor - the base color for the fade effect
        Returns:
        a Color-valued animation function for the default spacing
      • defaultOffsetFunction

        public static AnimationFunction<java.lang.Integer> defaultOffsetFunction()
        Returns the animation function for the default random position offset.
        Returns:
        an animation function for a default random offset
      • defaultScaleFunction

        public static AnimationFunction<java.lang.Float> defaultScaleFunction​(long duration)
        Creates and returns the default scaling animation function.
        Parameters:
        duration - the animation duration
        Returns:
        an animation function for the default scaling effect
      • defaultSpaceFunction

        public static AnimationFunction<java.lang.Float> defaultSpaceFunction​(long duration)
        Creates and returns the default spacing animation function.
        Parameters:
        duration - the animation duration
        Returns:
        an animation function for the default spacing effect
      • applyEffect

        protected void applyEffect​(long time)
        Applies the effect: sets color, spacing, scaling and offset, the latter only if enabled.
        Specified by:
        applyEffect in class AbstractAnimation
        Parameters:
        time - the render time
      • isOffsetEnabled

        public boolean isOffsetEnabled()
        Answers whether the random position offset is enabled.
        Returns:
        true indicates offset enabled, false disabled
      • setOffsetEnabled

        public void setOffsetEnabled​(boolean b)
        Enables or disables the random position offset.
        Parameters:
        b - the new enablement