< prev index next >

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

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


  26 package javafx.animation;
  27 
  28 import com.sun.scenario.animation.AbstractMasterTimer;
  29 import javafx.beans.property.ObjectProperty;
  30 import javafx.beans.property.SimpleObjectProperty;
  31 import javafx.scene.Node;
  32 
  33 /**
  34  * An abstract class that contains the basic functionalities required by all
  35  * {@code Transition} based animations, such as {@link PathTransition} and
  36  * {@link RotateTransition}.
  37  * <p>
  38  * This class offers a simple framework to define animation. It provides all the
  39  * basic functionality defined in {@link Animation}. {@code Transition} requires
  40  * the implementation of a method {@link #interpolate(double)} which is the
  41  * called in each frame, while the {@code Transition} is running.
  42  * <p>
  43  * In addition an extending class needs to set the duration of a single cycle
  44  * with {@link Animation#setCycleDuration(javafx.util.Duration)}. This duration
  45  * is usually set by the user via a duration property (as in
  46  * {@link FadeTransition#duration}) for example. But it can also be calculated
  47  * by the extending class as is done in {@link ParallelTransition} and
  48  * {@link FadeTransition}.
  49  * <p>
  50  * Below is a simple example. It creates a small animation that updates the
  51  * {@code text} property of a {@link javafx.scene.text.Text} node. It starts
  52  * with an empty {@code String} and adds gradually letter by letter until the
  53  * full {@code String} was set when the animation finishes.
  54  *
  55  * <pre>
  56  * {@code
  57  *
  58  * final String content = "Lorem ipsum";
  59  * final Text text = new Text(10, 20, "");
  60  *
  61  * final Animation animation = new Transition() {
  62  *     {
  63  *         setCycleDuration(Duration.millis(2000));
  64  *     }
  65  *
  66  *     protected void interpolate(double frac) {


 104 
 105     public final Interpolator getInterpolator() {
 106         return (interpolator == null) ? DEFAULT_INTERPOLATOR : interpolator.get();
 107     }
 108 
 109     public final ObjectProperty<Interpolator> interpolatorProperty() {
 110         if (interpolator == null) {
 111             interpolator = new SimpleObjectProperty<Interpolator>(
 112                     this, "interpolator", DEFAULT_INTERPOLATOR
 113             );
 114         }
 115         return interpolator;
 116     }
 117 
 118     private Interpolator cachedInterpolator;
 119 
 120     /**
 121      * Returns the {@link Interpolator}, that was set when the
 122      * {@code Transition} was started.
 123      *
 124      * Changing the {@link #interpolator} of a running {@code Transition} should
 125      * have no immediate effect. Instead the running {@code Transition} should
 126      * continue to use the original {@code Interpolator} until it is stopped and
 127      * started again.
 128      *
 129      * @return the {@code Interpolator} that was set when this
 130      *         {@code Transition} was started
 131      */
 132     protected Interpolator getCachedInterpolator() {
 133         return cachedInterpolator;
 134     }
 135 
 136     /**
 137      * The constructor of {@code Transition}.
 138      *
 139      * This constructor allows to define a {@link #targetFramerate}.
 140      *
 141      * @param targetFramerate
 142      *            The custom target frame rate for this {@code Transition}
 143      */
 144     public Transition(double targetFramerate) {
 145         super(targetFramerate);
 146     }
 147 
 148     /**
 149      * The constructor of {@code Transition}.
 150      */
 151     public Transition() {
 152     }
 153 
 154     // For testing purposes
 155     Transition(AbstractMasterTimer timer) {
 156         super(timer);
 157     }
 158 
 159     /**




  26 package javafx.animation;
  27 
  28 import com.sun.scenario.animation.AbstractMasterTimer;
  29 import javafx.beans.property.ObjectProperty;
  30 import javafx.beans.property.SimpleObjectProperty;
  31 import javafx.scene.Node;
  32 
  33 /**
  34  * An abstract class that contains the basic functionalities required by all
  35  * {@code Transition} based animations, such as {@link PathTransition} and
  36  * {@link RotateTransition}.
  37  * <p>
  38  * This class offers a simple framework to define animation. It provides all the
  39  * basic functionality defined in {@link Animation}. {@code Transition} requires
  40  * the implementation of a method {@link #interpolate(double)} which is the
  41  * called in each frame, while the {@code Transition} is running.
  42  * <p>
  43  * In addition an extending class needs to set the duration of a single cycle
  44  * with {@link Animation#setCycleDuration(javafx.util.Duration)}. This duration
  45  * is usually set by the user via a duration property (as in
  46  * {@link FadeTransition#durationProperty() duration}) for example. But it can also be calculated
  47  * by the extending class as is done in {@link ParallelTransition} and
  48  * {@link FadeTransition}.
  49  * <p>
  50  * Below is a simple example. It creates a small animation that updates the
  51  * {@code text} property of a {@link javafx.scene.text.Text} node. It starts
  52  * with an empty {@code String} and adds gradually letter by letter until the
  53  * full {@code String} was set when the animation finishes.
  54  *
  55  * <pre>
  56  * {@code
  57  *
  58  * final String content = "Lorem ipsum";
  59  * final Text text = new Text(10, 20, "");
  60  *
  61  * final Animation animation = new Transition() {
  62  *     {
  63  *         setCycleDuration(Duration.millis(2000));
  64  *     }
  65  *
  66  *     protected void interpolate(double frac) {


 104 
 105     public final Interpolator getInterpolator() {
 106         return (interpolator == null) ? DEFAULT_INTERPOLATOR : interpolator.get();
 107     }
 108 
 109     public final ObjectProperty<Interpolator> interpolatorProperty() {
 110         if (interpolator == null) {
 111             interpolator = new SimpleObjectProperty<Interpolator>(
 112                     this, "interpolator", DEFAULT_INTERPOLATOR
 113             );
 114         }
 115         return interpolator;
 116     }
 117 
 118     private Interpolator cachedInterpolator;
 119 
 120     /**
 121      * Returns the {@link Interpolator}, that was set when the
 122      * {@code Transition} was started.
 123      *
 124      * Changing the {@link #interpolatorProperty() interpolator} of a running {@code Transition} should
 125      * have no immediate effect. Instead the running {@code Transition} should
 126      * continue to use the original {@code Interpolator} until it is stopped and
 127      * started again.
 128      *
 129      * @return the {@code Interpolator} that was set when this
 130      *         {@code Transition} was started
 131      */
 132     protected Interpolator getCachedInterpolator() {
 133         return cachedInterpolator;
 134     }
 135 
 136     /**
 137      * The constructor of {@code Transition}.
 138      *
 139      * This constructor allows to define a {@link #getTargetFramerate() target framerate}.
 140      *
 141      * @param targetFramerate
 142      *            The custom target frame rate for this {@code Transition}
 143      */
 144     public Transition(double targetFramerate) {
 145         super(targetFramerate);
 146     }
 147 
 148     /**
 149      * The constructor of {@code Transition}.
 150      */
 151     public Transition() {
 152     }
 153 
 154     // For testing purposes
 155     Transition(AbstractMasterTimer timer) {
 156         super(timer);
 157     }
 158 
 159     /**


< prev index next >