public abstract class Trigger extends Object
fire()
or fire(TriggerEvent)
to start the timeline based on
an event that occurred.
Subclasses should call one of the constructors in Trigger, according to whether they want Trigger to discern between different TriggerEvents and whether they want Trigger to auto-reverse the animation based on opposite TriggerEvents.
Subclasses should call one of the fire
methods based on whether
they want Trigger to perform any event logic or simply start the animation.
Modifier | Constructor and Description |
---|---|
protected |
Trigger(org.pushingpixels.trident.Timeline timeline)
Creates a Trigger that will start the timeline when
fire() is
called. |
protected |
Trigger(org.pushingpixels.trident.Timeline timeline,
TriggerEvent triggerEvent)
Creates a Trigger that will start the timeline when
fire(TriggerEvent) is called with an event that equals
triggerEvent. |
protected |
Trigger(org.pushingpixels.trident.Timeline timeline,
TriggerEvent triggerEvent,
boolean autoReverse)
Creates a Trigger that will start the timeline when
fire(TriggerEvent) is called with an event that equals
triggerEvent. |
Modifier and Type | Method and Description |
---|---|
void |
disarm()
This method disables this Trigger and effectively noop's any actions that
would otherwise occur
|
protected void |
fire()
Utility method called by subclasses to start the timeline.
|
protected void |
fire(TriggerEvent currentEvent)
Called by subclasses to start the timeline if currentEvent equals the
event that the Trigger is based upon.
|
protected boolean |
isTimelineRunning()
Utility method checking if the timeline is running in forward or reverse
direction.
|
protected Trigger(org.pushingpixels.trident.Timeline timeline)
fire()
is
called. Subclasses call this method to set up a simple Trigger that will
be started by calling fire()
, and will have no dependency upon
the specific TriggerEvent
that must have occurred to start the
animator.timeline
- the Timeline that will start when the Trigger is firedprotected Trigger(org.pushingpixels.trident.Timeline timeline, TriggerEvent triggerEvent)
fire(TriggerEvent)
is called with an event that equals
triggerEvent.timeline
- the Timeline that will start when the Trigger is firedtriggerEvent
- the TriggerEvent that must occur for this Trigger to fireprotected Trigger(org.pushingpixels.trident.Timeline timeline, TriggerEvent triggerEvent, boolean autoReverse)
fire(TriggerEvent)
is called with an event that equals
triggerEvent. Also, automatically stops and reverses the timeline when
opposite event occurs, and stops reversing the timeline likewise when
triggerEvent occurs.timeline
- the Timeline that will start when the Trigger is firedtriggerEvent
- the TriggerEvent that must occur for this Trigger to fireautoReverse
- flag to determine whether the timeline should stop and reverse
based on opposite triggerEvents.TriggerEvent.getOppositeEvent()
public void disarm()
protected void fire(TriggerEvent currentEvent)
currentEvent
- the TriggerEvent
that just occurred, which will be
compared with the TriggerEvent used to construct this Trigger
and determine whether the timeline should be started or
reversedprotected void fire()
protected boolean isTimelineRunning()