|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.animation.Property
public abstract class Property
The Property class is the base class for animating values. Properties have a value, a behavior to control how the value changes, and listeners to alert when the value changes.
Properties have an abstract 32-bit value, and it's up to subclasses to interpret that value with get and set methods.
Constructor Summary | |
---|---|
Property(PropertyListener listener,
int value)
Creates a property with the specified listener and initial value. |
Method Summary | |
---|---|
void |
addListener(PropertyListener listener)
Adds the specified listener to receive events from this Property. |
abstract boolean |
equals(Object obj)
|
Behavior |
getBehavior()
Gets the behavior for this property, or null if this property currently does not have a behavior. |
PropertyListener[] |
getListeners()
Returns a newly allocated array of all the listeners registered on this Property. |
protected int |
getValue()
Gets the value for this property. |
abstract int |
hashCode()
|
boolean |
isAnimating()
Checks if this property has a behavior and it is not finished animating. |
void |
removeListener(PropertyListener listener)
Removes the specified listener so that it no longer receives events from this Property. |
void |
setBehavior(Behavior behavior)
Sets the behavior for this property, which may be null. |
protected void |
setValue(int value)
Sets the value for this property. |
protected abstract void |
setValue(Number value)
Sets the value for this property. |
void |
stopAnimation(boolean gracefully)
Stops the behavior, if any. |
void |
update(int elapsedTime)
Updates this Property, possibly modifying its value if it has a Behavior . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Property(PropertyListener listener, int value)
null
. The behavior is null
.
Method Detail |
---|
protected abstract void setValue(Number value)
value
- the new value.public abstract boolean equals(Object obj)
equals
in class Object
public abstract int hashCode()
hashCode
in class Object
protected final void setValue(int value)
value
- the new value.protected final int getValue()
public final void setBehavior(Behavior behavior)
behavior.update(0)
returns true
.
behavior
- The new behavior.public final Behavior getBehavior()
public final PropertyListener[] getListeners()
PropertyListener
s or an empty array if no
listeners are registered.public final void addListener(PropertyListener listener)
null
, no exception is thrown and no action is performed.
listener
- The listener to add.public final void removeListener(PropertyListener listener)
null
,
no exception is thrown and no action is performed.
listener
- The listener to remove.public final void update(int elapsedTime)
Behavior
.
This method should be called once per frame, and a Sprite
typically handles property updating.
elapsedTime
- Elapsed time since the last update, in milliseconds.public final boolean isAnimating()
public final void stopAnimation(boolean gracefully)
gracefully
- if true, the behavior is fast-forwarded to it's end and the property's
value is immediately set.
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |