|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.animation.AnimationTrigger
public class AnimationTrigger
Defines a class you can use to trigger animations to begin or end. You create the trigger, then add it to an animation as either a begin or end trigger.
When you call the fire()
method, the associated animation starts or ends.
// Create the animator. Animator animator = new Animator(25); // Create an event in which this class is the event source. AnimationTrigger myTrigger = new AnimationTrigger(); // Use a scalar for alpha AnimatedScalar alpha = new AnimatedScalar(1.0f); // Create an animation which will begin when the custom event is fired. Animation fadeoutAnimation = animator.addAnimationFromTo(alpha, AnimatedScalar.ANIMATION_PROPERTY_SCALAR, 1.0f, 0.0f, Animation.EASINGCURVE_LINEAR, 1000L); // Add a scheduling rule to only start when the custom event is fired. // The animation will begin 500ms after the trigger is fired. fadeoutAnimation.addBeginTrigger(_myTrigger, 500); ... ... protected boolean navigationClick(int status, int time) { // Trigger my animation to start. _myTrigger.fire(); }
// Create the animator. Animator animator = new Animator(25); // Use a scalar for alpha AnimatedScalar alpha = new AnimatedScalar(1.0f); // Create an animation to fade out Animation fadeoutAnimation = animator.addAnimationFromTo(alpha, AnimatedScalar.ANIMATION_PROPERTY_SCALAR, 1.0f, 0.0f, Animation.EASINGCURVE_LINEAR, 1000L); // Create a second animation to fade in Animation fadeinAnimation = animator.addAnimationFromTo(alpha, AnimatedScalar.ANIMATION_PROPERTY_SCALAR, 0.0f, 1.0f, Animation.EASINGCURVE_LINEAR, 1000L); // Add a scheduling rule to start the second fadein when the fade out animation is ended. fadeinAnimation.addBeginTrigger(fadeoutAnimation.getEndTrigger(), 0L); ... // Begin the fadeout animation fadeoutAnimation.begin(0L);
AbstractAnimation.addBeginTrigger(AnimationTrigger,long)
,
AbstractAnimation.addEndTrigger(AnimationTrigger,long)
,
AbstractAnimation.getBeginTrigger()
,
AbstractAnimation.getEndTrigger()
Constructor Summary | ||
---|---|---|
AnimationTrigger()
Class constructor. |
Method Summary | ||
---|---|---|
void |
fire()
Fires the trigger. |
|
long |
getTriggerTime()
Gets the system time when the trigger was fired. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnimationTrigger()
Class constructor.
Creates an AnimationTrigger
that can be used to trigger animations to begin or end.
Method Detail |
---|
public long getTriggerTime()
Gets the system time when the trigger was fired.
public void fire()
Fires the trigger. Any animations scheduled to begin or end on this event will be triggered by this call.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal