public final class Timeline extends Animation
Timeline
を使用すると、すべてのJavaFXプロパティ
など、あらゆるWritableValue
の自由形式アニメーションを定義できます。
Timeline
は、1つ以上のKeyFrame
で定義し、個々のKeyFrame
をKeyFrame.time
で指定した順序で順番に処理するために使用します。アニメーション化されるプロパティは、KeyFrame.values
でキー値として定義し、Timeline
の初期位置(Timeline
の方向によって異なる)を基準にしてKeyFrame
の指定時間にターゲット・キー値に(またはターゲット・キー値から)補間されます。
Timeline
では、個々のKeyFrame
は指定された時間間隔が経過した時点以降に処理され、KeyFrame
の処理タイミングは保証されません。
Animation.cycleDurationProperty()
は、TimelineのKeyFrameの最大時間値に設定されます。
time==0s
の瞬間にKeyFrame
が指定されていない場合は、Animation.play()
またはAnimation.playFromStart()
の呼出し時点における最新のターゲット値を使用して合成されます。
実行中のTimeline
のkeyFrames
は変更できません。実行中のTimeline
のkeyFrames
の値が変更された場合、新しい値を反映するには、停止して再度開始する必要があります。
単純なTimelineの作成例を次に示します。
final Timeline timeline = new Timeline();
timeline.setCycleCount(2);
timeline.setAutoReverse(true);
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000),
new KeyValue (node.translateXProperty(), 25)));
timeline.play();
このTimelineは10秒間実行され、ノードはx軸に沿って値25までアニメーション化され、2回目のサイクルに0まで戻ります。
警告: 実行中のTimelineはFXランタイムから参照されます。Timelineを無限にした場合、適切に停止しないと、メモリー・リークが発生する可能性があります。アニメーション化されるプロパティを持つすべてのオブジェクトがガベージ・コレクションの対象となるわけではありません。
autoReverse, currentRate, currentTime, cycleCount, cycleDuration, delay, onFinished, rate, status, totalDuration
Animation.Status
INDEFINITE
コンストラクタと説明 |
---|
Timeline()
Timeline のコンストラクタ。 |
Timeline(double targetFramerate)
Timeline のコンストラクタ。 |
Timeline(double targetFramerate, KeyFrame... keyFrames)
Timeline のコンストラクタ。 |
Timeline(KeyFrame... keyFrames)
Timeline のコンストラクタ。 |
修飾子と型 | メソッドと説明 |
---|---|
ObservableList<KeyFrame> |
getKeyFrames()
この
Timeline のKeyFrames を返します。 |
void |
stop()
アニメーションを停止し、再生ヘッドを初期位置にリセットします。
|
autoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, isAutoReverse, jumpTo, jumpTo, onFinishedProperty, pause, play, playFrom, playFrom, playFromStart, rateProperty, setAutoReverse, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, statusProperty, totalDurationProperty
public Timeline(double targetFramerate, KeyFrame... keyFrames)
Timeline
のコンストラクタ。このコンストラクタでは、Animation.targetFramerate
を定義できます。targetFramerate
- このTimeline
のカスタム・ターゲット・フレームレートkeyFrames
- このTimeline
のキー・フレームpublic Timeline(KeyFrame... keyFrames)
Timeline
のコンストラクタ。keyFrames
- このTimeline
のキー・フレームpublic Timeline(double targetFramerate)
Timeline
のコンストラクタ。このコンストラクタでは、Animation.targetFramerate
を定義できます。targetFramerate
- このTimeline
のカスタム・ターゲット・フレームレートpublic Timeline()
Timeline
のコンストラクタ。public final ObservableList<KeyFrame> getKeyFrames()
Timeline
のKeyFrames
を返します。Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.