StrokedShape.Animator<AnimatorType extends Animator<AnimatorType>>
java.lang.Object
sofia.graphics.Shape.Animator<AnimatorType extends sofia.graphics.Shape.Animator<AnimatorType>>
sofia.graphics.StrokedShape.Animator<AnimatorType extends sofia.graphics.StrokedShape.Animator<AnimatorType>>
sofia.graphics.FillableShape.Animator<AnimatorType extends sofia.graphics.FillableShape.Animator<AnimatorType>>
Provides animation support for shapes. Most uses of this class will not need to reference it directly; for example, an animation can be constructed and played by chaining method calls directly:
shape.animate(500).color(Color.blue).alpha(128).play();In situations where the type of the class must be referenced directly (for example, when one is passed to an event handler like
onAnimationDone
), referring to the name of that type can be
somewhat awkward due to the use of some Java generics tricks to ensure
that the methods chain properly. In nearly all cases, it is reasonable
to use a "?" wildcard in place of the generic parameter:
Shape.Animator<?> anim = shape.animate(500).color(Color.blue); anim.play();
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
FillableShape.Animator(long duration)
Creates a new animator for the specified shape.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AnimatorType
|
fillColor(Color fillColor)
Sets the final fill color of the shape when the animation ends.
| ||||||||||
FillableShape
|
getShape()
Gets the shape that the receiver is animating.
|
Methods inherited from
class
sofia.graphics.StrokedShape.Animator
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
StrokedShape
|
getShape()
Gets the shape that the receiver is animating.
| ||||||||||
AnimatorType
|
strokeWidth(double strokeWidth)
Sets the final stroke width of the shape when the animation ends.
|
Methods inherited from
class
sofia.graphics.Shape.Animator
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void
|
addTransformer(PropertyTransformer transformer)
Adds a property transformer to the list of those that will be applied
each time the animation advances.
| ||||||||||
boolean
|
advanceTo(long time)
This method is intended for internal use.
| ||||||||||
AnimatorType
|
alpha(int alpha)
Sets the final alpha (opacity) of the shape when the animation ends.
| ||||||||||
AnimatorType
|
bounds(RectF bounds)
Sets the final bounds of the shape when the animation ends.
| ||||||||||
AnimatorType
|
color(Color color)
Sets the final color of the shape when the animation ends.
| ||||||||||
AnimatorType
|
delay(long newDelay)
Sets the delay, in milliseconds, that the animation will wait after the
play() method is called until it actually starts. | ||||||||||
long
|
getDelay()
Gets the delay, in milliseconds, that this animation will wait (or
did wait) before starting.
| ||||||||||
long
|
getDuration()
Gets the duration of this animation in milliseconds.
| ||||||||||
Shape
|
getShape()
Gets the shape that the receiver is animating.
| ||||||||||
boolean
|
isBackward()
Gets a value indicating whether the animation is playing backward.
| ||||||||||
boolean
|
isForward()
Gets a value indicating whether the animation is playing forward.
| ||||||||||
boolean
|
isPlaying()
Gets a value indicating whether the animation is currently playing,
either forward or backward.
| ||||||||||
AnimatorType
|
moveBy(float dx, float dy)
Sets the final position of the shape when the animation ends as a
relative shift from the shape's position when the animation starts.
| ||||||||||
AnimatorType
|
moveBy(MotionStep motionStep)
| ||||||||||
AnimatorType
|
moveBy(float dx, float dy, float ax, float ay)
| ||||||||||
AnimatorType
|
name(String newName)
Sets the name of this animation. | ||||||||||
AnimatorType
|
oscillate()
Causes the animation to oscillate (from start to end and back to
start) until stopped.
| ||||||||||
void
|
play()
Starts the animation.
| ||||||||||
AnimatorType
|
position(float x, float y)
Sets the final position of the shape when the animation ends.
| ||||||||||
AnimatorType
|
position(PointF point)
Sets the final position of the shape when the animation ends.
| ||||||||||
AnimatorType
|
removeWhenComplete()
Causes the shape to be automatically removed from its view when the animation completes. | ||||||||||
AnimatorType
|
repeat()
Causes the animation to repeat until stopped.
| ||||||||||
AnimatorType
|
repeatMode(RepeatMode mode)
Sets the repeat mode for this animation.
| ||||||||||
AnimatorType
|
rotation(float rotation)
Sets the final rotation, in degrees clockwise, of the shape when the animation ends. | ||||||||||
void
|
stop()
Stops the animation.
| ||||||||||
AnimatorType
|
timing(Interpolator newInterpolator)
Sets the timing function (interpolator) that determines how the
animation behaves during execution.
| ||||||||||
AnimatorType
|
x(float x)
Sets the final x-coordinate of the shape when the animation ends.
| ||||||||||
AnimatorType
|
y(float y)
Sets the final y-coordinate of the shape when the animation ends.
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Creates a new animator for the specified shape. Users cannot call
call this constructor directly; instead, they need to use the
animate(long)
method to get an animator object.
Sets the final fill color of the shape when the animation ends.
this animator, for method chaining
Gets the shape that the receiver is animating.
the shape that the receiver is animating