com.jgoodies.animation.animations

Class BasicTextAnimation

Implemented Interfaces:
Animation

public final class BasicTextAnimation
extends AbstractAnimation

A basic text animation that fades in a text, changes the x and y scaling, the position, and the space between glyphs.
Version:
$Revision: 1.1 $
Author:
Karsten Lentzsch
See Also:
Animation, BasicTextLabel, AnimationFunction, AnimationFunctions

Constructor Summary

BasicTextAnimation(BasicTextLabel label, long duration, String text, AnimationFunction colorFunction, AnimationFunction scaleXFunction, AnimationFunction scaleYFunction, AnimationFunction spaceFunction)
Constructs a text animation, that fades in a text, scales it and fades it out.

Method Summary

protected void
applyEffect(long time)
Applies the effect: sets color, spacing, scaling and offset, the latter only if enabled.
static AnimationFunction
cinemaFadeColorFunction(long duration, Color baseColor)
Creates and answers the color animation function for the default fade.
static BasicTextAnimation
defaultFade(BasicTextLabel label, long duration, String text, Color baseColor)
Creates and answers an animation, that provides a text fade-in and -out.
static AnimationFunction
defaultFadeColorFunction(long duration, Color baseColor)
Creates and answers the color animation function for the default fade.
static AnimationFunction
defaultOffsetFunction()
Returns the animation function for the default random position offset.
static BasicTextAnimation
defaultScale(BasicTextLabel label, long duration, String text, Color baseColor)
Creates and answers an animation, that provides a text fade-in and -out and scales the text while fading out.
static AnimationFunction
defaultScaleColorFunction(long duration, Color baseColor)
Creates and answers the animation function for the default scaling.
static AnimationFunction
defaultScaleFunction(long duration)
Creates and answers the default scaling animation function.
static BasicTextAnimation
defaultSpace(BasicTextLabel label, long duration, String text, Color baseColor)
Creates and answers an animation, that provides a text fade-in and -out and increases the glyph spacing.
static AnimationFunction
defaultSpaceColorFunction(long duration, Color baseColor)
Creates and answers the color animation function for the default spacing animation.
static AnimationFunction
defaultSpaceFunction(long duration)
Creates and answers the default spacing animation function.
boolean
isOffsetEnabled()
Answers whether the random position offset is enabled.
void
setOffsetEnabled(boolean b)
Enables or disables the random position offset.

Methods inherited from class com.jgoodies.animation.AbstractAnimation

addAnimationListener, animate, applyEffect, duration, fireAnimationStarted, fireAnimationStopped, isFreezed, removeAnimationListener, toString

Constructor Details

BasicTextAnimation

public BasicTextAnimation(BasicTextLabel label,
                          long duration,
                          String text,
                          AnimationFunction colorFunction,
                          AnimationFunction scaleXFunction,
                          AnimationFunction scaleYFunction,
                          AnimationFunction 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 Details

applyEffect

protected void applyEffect(long time)
Applies the effect: sets color, spacing, scaling and offset, the latter only if enabled.
Overrides:
applyEffect in interface AbstractAnimation
Parameters:
time - the render time

cinemaFadeColorFunction

public static AnimationFunction cinemaFadeColorFunction(long duration,
                                                        Color baseColor)
Creates and answers 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

defaultFade

public static BasicTextAnimation defaultFade(BasicTextLabel label,
                                             long duration,
                                             String text,
                                             Color baseColor)
Creates and answers an animation, that provides 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

defaultFadeColorFunction

public static AnimationFunction defaultFadeColorFunction(long duration,
                                                         Color baseColor)
Creates and answers 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

defaultOffsetFunction

public static AnimationFunction defaultOffsetFunction()
Returns the animation function for the default random position offset.
Returns:
an animation function for a default random offset

defaultScale

public static BasicTextAnimation defaultScale(BasicTextLabel label,
                                              long duration,
                                              String text,
                                              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

defaultScaleColorFunction

public static AnimationFunction defaultScaleColorFunction(long duration,
                                                          Color baseColor)
Creates and answers 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

defaultScaleFunction

public static AnimationFunction defaultScaleFunction(long duration)
Creates and answers the default scaling animation function.
Parameters:
duration - the animation duration
Returns:
an animation function for the default scaling effect

defaultSpace

public static BasicTextAnimation defaultSpace(BasicTextLabel label,
                                              long duration,
                                              String text,
                                              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

defaultSpaceColorFunction

public static AnimationFunction defaultSpaceColorFunction(long duration,
                                                          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

defaultSpaceFunction

public static AnimationFunction defaultSpaceFunction(long duration)
Creates and answers the default spacing animation function.
Parameters:
duration - the animation duration
Returns:
an animation function for the default spacing effect

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

Copyright © 2001-2006 JGoodies Karsten Lentzsch. All Rights Reserved.