Package com.starpoints.animation
Class PointAnimation
- java.lang.Object
-
- com.starpoints.animation.Animation
-
- com.starpoints.animation.PointAnimation
-
- All Implemented Interfaces:
java.io.Serializable
public class PointAnimation extends Animation
Point animation info for color animations and chain explosions.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.starpoints.animation.Animation
duration, startDuration
-
-
Constructor Summary
Constructors Constructor Description PointAnimation(Point point)
Creates an empty point animation.PointAnimation(Point point, int color, int oldColor)
Creates a color change animation.PointAnimation(Point point, int color, int oldColor, boolean causedBySwirl)
Creates a color change animation.PointAnimation(Point point, Point target)
Creates a chain explosion animation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getChainExplosionAnimationIndex()
Gets the chain explosion index.int
getColor()
Gets the new color.protected Animation
getCopyForNextAnimation()
Gets a copy for the next AnimationInfo.int
getOldColor()
Gets the old color.Point
getTarget()
Gets the target point of a chain explosion.boolean
hasChainExplosionAnimation()
Checks, if point has chain explosion animation.boolean
hasColorAnimation()
Checks, if color animation exists.boolean
isCausedBySwirl()
Checks, if color effect was caused by swirling.void
setCausedBySwirl(boolean causedBySwirl)
Sets, if color effect was caused by swirling.void
setChainExplosionAnimation(Point target)
Sets the target of a chain explosion.PointColorAnimation
setColorAnimation(int color, int oldColor)
Sets the color info with no swirling.PointColorAnimation
setColorAnimation(int color, int oldColor, boolean causedBySwirl)
Sets the color info.-
Methods inherited from class com.starpoints.animation.Animation
clone, getLifecycleIndex
-
-
-
-
Constructor Detail
-
PointAnimation
public PointAnimation(Point point)
Creates an empty point animation.- Parameters:
point
- The point.
-
PointAnimation
public PointAnimation(Point point, Point target)
Creates a chain explosion animation.- Parameters:
point
- The source point.target
- the target point.
-
PointAnimation
public PointAnimation(Point point, int color, int oldColor)
Creates a color change animation.- Parameters:
point
- The point.color
- The new color.oldColor
- The old color.
-
PointAnimation
public PointAnimation(Point point, int color, int oldColor, boolean causedBySwirl)
Creates a color change animation.- Parameters:
point
- The point.color
- The new color.oldColor
- The old color.causedBySwirl
- Flag, if caused by swirling.
-
-
Method Detail
-
getTarget
public Point getTarget()
Gets the target point of a chain explosion.- Returns:
- The chain expl. target.
-
setChainExplosionAnimation
public void setChainExplosionAnimation(Point target)
Sets the target of a chain explosion.- Parameters:
target
- The target.
-
setColorAnimation
public PointColorAnimation setColorAnimation(int color, int oldColor)
Sets the color info with no swirling.- Parameters:
color
- The new color.oldColor
- The old color.- Returns:
- The color animation.
-
setColorAnimation
public PointColorAnimation setColorAnimation(int color, int oldColor, boolean causedBySwirl)
Sets the color info.- Parameters:
color
- The new color.oldColor
- The old color.causedBySwirl
- Flag, if caused by swirling.- Returns:
- The color animation.
-
getColor
public int getColor()
Gets the new color.- Returns:
- The new color.
-
getOldColor
public int getOldColor()
Gets the old color.- Returns:
- The old color.
-
isCausedBySwirl
public boolean isCausedBySwirl()
Checks, if color effect was caused by swirling.- Returns:
- The causedBySwirl-flag.
-
setCausedBySwirl
public void setCausedBySwirl(boolean causedBySwirl)
Sets, if color effect was caused by swirling.- Parameters:
causedBySwirl
- The causedBySwirl-flag to set.
-
hasChainExplosionAnimation
public boolean hasChainExplosionAnimation()
Checks, if point has chain explosion animation.- Returns:
- true, if chain exploding.
-
getChainExplosionAnimationIndex
public int getChainExplosionAnimationIndex()
Gets the chain explosion index.- Returns:
- The chain expl. index.
-
hasColorAnimation
public boolean hasColorAnimation()
Checks, if color animation exists.- Returns:
- true, if color is animated.
-
getCopyForNextAnimation
protected Animation getCopyForNextAnimation()
Gets a copy for the next AnimationInfo.- Overrides:
getCopyForNextAnimation
in classAnimation
- Returns:
- This instance with a reduced duration or null, if end of lifecyle is reached.
-
-