1 /*
2 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
45 * to/from the targeted key values at the specified time of the {@code KeyFrame}
46 * to {@code Timeline}'s initial position, depends on {@code Timeline}'s
47 * direction.
48 * <p>
49 * {@code Timeline} processes individual {@code KeyFrame} at or after specified
50 * time interval elapsed, it does not guarantee the timing when {@code KeyFrame}
51 * is processed.
52 * <p>
53 * The {@link #cycleDurationProperty()} will be set to the largest time value
54 * of Timeline's keyFrames.
55 * <p>
56 * If a {@code KeyFrame} is not provided for the {@code time==0s} instant, one
57 * will be synthesized using the target values that are current at the time
58 * {@link #play()} or {@link #playFromStart()} is called.
59 * <p>
60 * It is not possible to change the {@code keyFrames} of a running {@code Timeline}.
61 * If the value of {@code keyFrames} is changed for a running {@code Timeline}, it
62 * has to be stopped and started again to pick up the new value.
63 * <p>
64 * A simple Timeline can be created like this:
65 * <pre>{@code
66 * final Timeline timeline = new Timeline();
67 * timeline.setCycleCount(2);
68 * timeline.setAutoReverse(true);
69 * timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000),
70 * new KeyValue (node.translateXProperty(), 25)));
71 * timeline.play();
72 * }</pre>
73 * <p>
74 * This Timeline will run for 10s, animating the node by x axis to value 25 and then back to 0 on the second cycle.
75 * <p>
76 * <b>Warning:</b> A running Timeline is being referenced from the FX runtime. Infinite Timeline
77 * might result in a memory leak if not stopped properly. All the objects with animated properties would not be garbage collected.
78 *
79 * @see Animation
80 * @see KeyFrame
81 * @see KeyValue
82 *
83 * @since JavaFX 2.0
84 */
85 public final class Timeline extends Animation {
86 /* Package-private for testing purposes */
87 final TimelineClipCore clipCore;
88
89 /**
90 * Returns the {@link KeyFrame KeyFrames} of this {@code Timeline}.
91 * @return the {@link KeyFrame KeyFrames}
92 */
|
1 /*
2 * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
45 * to/from the targeted key values at the specified time of the {@code KeyFrame}
46 * to {@code Timeline}'s initial position, depends on {@code Timeline}'s
47 * direction.
48 * <p>
49 * {@code Timeline} processes individual {@code KeyFrame} at or after specified
50 * time interval elapsed, it does not guarantee the timing when {@code KeyFrame}
51 * is processed.
52 * <p>
53 * The {@link #cycleDurationProperty()} will be set to the largest time value
54 * of Timeline's keyFrames.
55 * <p>
56 * If a {@code KeyFrame} is not provided for the {@code time==0s} instant, one
57 * will be synthesized using the target values that are current at the time
58 * {@link #play()} or {@link #playFromStart()} is called.
59 * <p>
60 * It is not possible to change the {@code keyFrames} of a running {@code Timeline}.
61 * If the value of {@code keyFrames} is changed for a running {@code Timeline}, it
62 * has to be stopped and started again to pick up the new value.
63 * <p>
64 * A simple Timeline can be created like this:
65 * <pre> {@code final Timeline timeline = new Timeline();
66 * timeline.setCycleCount(2);
67 * timeline.setAutoReverse(true);
68 * timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000),
69 * new KeyValue (node.translateXProperty(), 25)));
70 * timeline.play();}</pre>
71 * <p>
72 * This Timeline will run for 10s, animating the node by x axis to value 25 and then back to 0 on the second cycle.
73 * <p>
74 * <b>Warning:</b> A running Timeline is being referenced from the FX runtime. Infinite Timeline
75 * might result in a memory leak if not stopped properly. All the objects with animated properties would not be garbage collected.
76 *
77 * @see Animation
78 * @see KeyFrame
79 * @see KeyValue
80 *
81 * @since JavaFX 2.0
82 */
83 public final class Timeline extends Animation {
84 /* Package-private for testing purposes */
85 final TimelineClipCore clipCore;
86
87 /**
88 * Returns the {@link KeyFrame KeyFrames} of this {@code Timeline}.
89 * @return the {@link KeyFrame KeyFrames}
90 */
|