< prev index next >

modules/javafx.graphics/src/main/java/javafx/animation/Animation.java

Print this page
rev 10598 : 8185767: Fix broken links in Javadocs


  43 import javafx.beans.property.SimpleObjectProperty;
  44 import javafx.collections.FXCollections;
  45 import javafx.collections.ObservableMap;
  46 import javafx.event.ActionEvent;
  47 import javafx.event.EventHandler;
  48 import javafx.util.Duration;
  49 import com.sun.javafx.animation.TickCalculation;
  50 import com.sun.scenario.animation.AbstractMasterTimer;
  51 import com.sun.scenario.animation.shared.ClipEnvelope;
  52 import com.sun.scenario.animation.shared.PulseReceiver;
  53 
  54 import static com.sun.javafx.animation.TickCalculation.*;
  55 import java.security.AccessControlContext;
  56 import java.security.AccessController;
  57 import java.security.PrivilegedAction;
  58 
  59 /**
  60  * The class {@code Animation} provides the core functionality of all animations
  61  * used in the JavaFX runtime.
  62  * <p>
  63  * An animation can run in a loop by setting {@link #cycleCount}. To make an
  64  * animation run back and forth while looping, set the {@link #autoReverse}
  65  * -flag.
  66  * <p>
  67  * Call {@link #play()} or {@link #playFromStart()} to play an {@code Animation}
  68  * . The {@code Animation} progresses in the direction and speed specified by
  69  * {@link #rate}, and stops when its duration is elapsed. An {@code Animation}
  70  * with indefinite duration (a {@link #cycleCount} of {@link #INDEFINITE}) runs
  71  * repeatedly until the {@link #stop()} method is explicitly called, which will
  72  * stop the running {@code Animation} and reset its play head to the initial
  73  * position.
  74  * <p>
  75  * An {@code Animation} can be paused by calling {@link #pause()}, and the next
  76  * {@link #play()} call will resume the {@code Animation} from where it was
  77  * paused.
  78  * <p>
  79  * An {@code Animation}'s play head can be randomly positioned, whether it is
  80  * running or not. If the {@code Animation} is running, the play head jumps to
  81  * the specified position immediately and continues playing from new position.
  82  * If the {@code Animation} is not running, the next {@link #play()} will start
  83  * the {@code Animation} from the specified position.
  84  * <p>
  85  * Inverting the value of {@link #rate} toggles the play direction.
  86  *
  87  * @see Timeline
  88  * @see Transition
  89  *
  90  * @since JavaFX 2.0
  91  */
  92 public abstract class Animation {
  93 
  94     static {
  95         AnimationAccessorImpl.DEFAULT = new AnimationAccessorImpl();
  96     }
  97 
  98     /**
  99      * Used to specify an animation that repeats indefinitely, until the
 100      * {@code stop()} method is called.
 101      */
 102     public static final int INDEFINITE = -1;
 103 
 104     /**
 105      * The possible states for {@link Animation#statusProperty status}.
 106      * @since JavaFX 2.0
 107      */
 108     public static enum Status {
 109         /**
 110          * The paused state.
 111          */
 112         PAUSED,
 113         /**
 114          * The running state.
 115          */
 116         RUNNING,
 117         /**
 118          * The stopped state.
 119          */
 120         STOPPED
 121     }
 122 
 123     private static final double EPSILON = 1e-12;
 124 
 125     /*


 704         }
 705         return onFinished;
 706     }
 707 
 708     private final ObservableMap<String, Duration> cuePoints = FXCollections
 709             .observableMap(new HashMap<String, Duration>(0));
 710 
 711     /**
 712      * The cue points can be
 713      * used to mark important positions of the {@code Animation}. Once a cue
 714      * point was defined, it can be used as an argument of
 715      * {@link #jumpTo(String) jumpTo()} and {@link #playFrom(String) playFrom()}
 716      * to move to the associated position quickly.
 717      * <p>
 718      * Every {@code Animation} has two predefined cue points {@code "start"} and
 719      * {@code "end"}, which are set at the start respectively the end of the
 720      * {@code Animation}. The predefined cuepoints do not appear in the map,
 721      * attempts to override them have no effect.
 722      * <p>
 723      * Another option to define a cue point in a {@code Animation} is to set the
 724      * {@link KeyFrame#name} property of a {@link KeyFrame}.
 725      *
 726      * @return {@link javafx.collections.ObservableMap} of cue points
 727      */
 728     public final ObservableMap<String, Duration> getCuePoints() {
 729         return cuePoints;
 730     }
 731 
 732     /**
 733      * Jumps to a given position in this {@code Animation}.
 734      *
 735      * If the given time is less than {@link Duration#ZERO}, this method will
 736      * jump to the start of the animation. If the given time is larger than the
 737      * duration of this {@code Animation}, this method will jump to the end.
 738      *
 739      * @param time
 740      *            the new position
 741      * @throws NullPointerException
 742      *             if {@code time} is {@code null}
 743      * @throws IllegalArgumentException
 744      *             if {@code time} is {@link Duration#UNKNOWN}




  43 import javafx.beans.property.SimpleObjectProperty;
  44 import javafx.collections.FXCollections;
  45 import javafx.collections.ObservableMap;
  46 import javafx.event.ActionEvent;
  47 import javafx.event.EventHandler;
  48 import javafx.util.Duration;
  49 import com.sun.javafx.animation.TickCalculation;
  50 import com.sun.scenario.animation.AbstractMasterTimer;
  51 import com.sun.scenario.animation.shared.ClipEnvelope;
  52 import com.sun.scenario.animation.shared.PulseReceiver;
  53 
  54 import static com.sun.javafx.animation.TickCalculation.*;
  55 import java.security.AccessControlContext;
  56 import java.security.AccessController;
  57 import java.security.PrivilegedAction;
  58 
  59 /**
  60  * The class {@code Animation} provides the core functionality of all animations
  61  * used in the JavaFX runtime.
  62  * <p>
  63  * An animation can run in a loop by setting {@link #cycleCountProperty() cycleCount}.
  64  * To make an animation run back and forth while looping, set the
  65  * {@link #autoReverseProperty() autoReverse} -flag.
  66  * <p>
  67  * Call {@link #play()} or {@link #playFromStart()} to play an {@code Animation}
  68  * . The {@code Animation} progresses in the direction and speed specified by
  69  * {@link #rateProperty() rate}, and stops when its duration is elapsed. An {@code Animation}
  70  * with indefinite duration (a {@link #cycleCountProperty() cycleCount} of {@link #INDEFINITE}) runs
  71  * repeatedly until the {@link #stop()} method is explicitly called, which will
  72  * stop the running {@code Animation} and reset its play head to the initial
  73  * position.
  74  * <p>
  75  * An {@code Animation} can be paused by calling {@link #pause()}, and the next
  76  * {@link #play()} call will resume the {@code Animation} from where it was
  77  * paused.
  78  * <p>
  79  * An {@code Animation}'s play head can be randomly positioned, whether it is
  80  * running or not. If the {@code Animation} is running, the play head jumps to
  81  * the specified position immediately and continues playing from new position.
  82  * If the {@code Animation} is not running, the next {@link #play()} will start
  83  * the {@code Animation} from the specified position.
  84  * <p>
  85  * Inverting the value of {@link #rateProperty() rate} toggles the play direction.
  86  *
  87  * @see Timeline
  88  * @see Transition
  89  *
  90  * @since JavaFX 2.0
  91  */
  92 public abstract class Animation {
  93 
  94     static {
  95         AnimationAccessorImpl.DEFAULT = new AnimationAccessorImpl();
  96     }
  97 
  98     /**
  99      * Used to specify an animation that repeats indefinitely, until the
 100      * {@code stop()} method is called.
 101      */
 102     public static final int INDEFINITE = -1;
 103 
 104     /**
 105      * The possible states for {@link Animation#statusProperty() status}.
 106      * @since JavaFX 2.0
 107      */
 108     public static enum Status {
 109         /**
 110          * The paused state.
 111          */
 112         PAUSED,
 113         /**
 114          * The running state.
 115          */
 116         RUNNING,
 117         /**
 118          * The stopped state.
 119          */
 120         STOPPED
 121     }
 122 
 123     private static final double EPSILON = 1e-12;
 124 
 125     /*


 704         }
 705         return onFinished;
 706     }
 707 
 708     private final ObservableMap<String, Duration> cuePoints = FXCollections
 709             .observableMap(new HashMap<String, Duration>(0));
 710 
 711     /**
 712      * The cue points can be
 713      * used to mark important positions of the {@code Animation}. Once a cue
 714      * point was defined, it can be used as an argument of
 715      * {@link #jumpTo(String) jumpTo()} and {@link #playFrom(String) playFrom()}
 716      * to move to the associated position quickly.
 717      * <p>
 718      * Every {@code Animation} has two predefined cue points {@code "start"} and
 719      * {@code "end"}, which are set at the start respectively the end of the
 720      * {@code Animation}. The predefined cuepoints do not appear in the map,
 721      * attempts to override them have no effect.
 722      * <p>
 723      * Another option to define a cue point in a {@code Animation} is to set the
 724      * {@link KeyFrame#getName() name} property of a {@link KeyFrame}.
 725      *
 726      * @return {@link javafx.collections.ObservableMap} of cue points
 727      */
 728     public final ObservableMap<String, Duration> getCuePoints() {
 729         return cuePoints;
 730     }
 731 
 732     /**
 733      * Jumps to a given position in this {@code Animation}.
 734      *
 735      * If the given time is less than {@link Duration#ZERO}, this method will
 736      * jump to the start of the animation. If the given time is larger than the
 737      * duration of this {@code Animation}, this method will jump to the end.
 738      *
 739      * @param time
 740      *            the new position
 741      * @throws NullPointerException
 742      *             if {@code time} is {@code null}
 743      * @throws IllegalArgumentException
 744      *             if {@code time} is {@link Duration#UNKNOWN}


< prev index next >