public class TimingTrigger extends Trigger implements TimingTarget
TimingTrigger trigger = TimingTrigger.addTrigger(anim1, anim2, TimingTriggerEvent.STOP);
Constructor and Description |
---|
TimingTrigger(Animator animator,
TimingTriggerEvent event)
Creates a non-auto-reversing TimingTrigger, which should be added
to an Animator which will generate the events sent to the
trigger.
|
TimingTrigger(Animator animator,
TimingTriggerEvent event,
boolean autoReverse)
Creates a TimingTrigger, which should be added
to an Animator which will generate the events sent to the
trigger.
|
Modifier and Type | Method and Description |
---|---|
static TimingTrigger |
addTrigger(Animator source,
Animator target,
TimingTriggerEvent event)
Creates a non-auto-reversing TimingTrigger and adds it as a target
to the source Animator.
|
static TimingTrigger |
addTrigger(Animator source,
Animator target,
TimingTriggerEvent event,
boolean autoReverse)
Creates a TimingTrigger and adds it as a target
to the source Animator.
|
void |
begin()
Called by Animator when starting.
|
void |
end()
Called by Animator when ending.
|
void |
repeat()
Called by Animator when repeating.
|
void |
timingEvent(float fraction)
Implementation of TimingTarget method; this method does nothing
in this implementation since the events of TimingTrigger are limited
to START, STOP, and REPEAT
|
public TimingTrigger(Animator animator, TimingTriggerEvent event)
public TimingTrigger(Animator animator, TimingTriggerEvent event, boolean autoReverse)
public static TimingTrigger addTrigger(Animator source, Animator target, TimingTriggerEvent event)
source
- the Animator that will be listened to for events
to start the target Animatortarget
- the Animator that will start when the event occursevent
- the TimingTriggerEvent that will cause targetAnimator
to startAnimator.addTarget(TimingTarget)
public static TimingTrigger addTrigger(Animator source, Animator target, TimingTriggerEvent event, boolean autoReverse)
source
- the Animator that will be listened to for events
to start the target Animatortarget
- the Animator that will start when the event occursevent
- the TimingTriggerEvent that will cause targetAnimator
to startautoReverse
- flag to determine whether the animator should
stop and reverse based on opposite triggerEvents.Animator.addTarget(TimingTarget)
public void timingEvent(float fraction)
timingEvent
in interface TimingTarget
fraction
- the fraction of completion between the start and
end of the current cycle. Note that on reversing cycles
(Animator.Direction.BACKWARD
) the fraction decreases
from 1.0 to 0 on backwards-running cycles. Note also that animations
with a duration of INFINITE
will call
timingEvent with an undefined value for fraction, since there is
no fraction that makes sense if the animation has no defined length.Animator.Direction
public void begin()
begin
in interface TimingTarget
public void end()
end
in interface TimingTarget
public void repeat()
repeat
in interface TimingTarget