本文整理汇总了Java中javafx.animation.Interpolator.LINEAR属性的典型用法代码示例。如果您正苦于以下问题:Java Interpolator.LINEAR属性的具体用法?Java Interpolator.LINEAR怎么用?Java Interpolator.LINEAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.animation.Interpolator
的用法示例。
在下文中一共展示了Interpolator.LINEAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateValue
private void animateValue(double from,
double to,
Duration duration,
Interpolator interpolator, DoubleConsumer consumer,
EventHandler<ActionEvent> l) {
timeline.stop();
timeline.getKeyFrames().clear();
KeyValue keyValue = new KeyValue(new WritableValue<Double>() {
@Override
public Double getValue() {
return from;
}
@Override
public void setValue(Double value) {
consumer.accept(value);
}
}, to, interpolator == null ? Interpolator.LINEAR : interpolator);
timeline.getKeyFrames().add(new KeyFrame(duration, keyValue));
timeline.setOnFinished(l);
timeline.play();
}
示例2: reset
@Override
public void reset() {
image = null;
startPosition.setZero();
position.setZero();
velocity.setZero();
acceleration.setZero();
radius.setZero();
scale.setZero();
startColor = Color.TRANSPARENT;
endColor = Color.TRANSPARENT;
blendMode = BlendMode.SRC_OVER;
initialLife = 0;
life = 0;
interpolator = Interpolator.LINEAR;
control = null;
}
示例3: getKeyFrames
private KeyFrame[] getKeyFrames(double angle, double duration, Paint color) {
KeyFrame[] frames = new KeyFrame[4];
frames[0] = new KeyFrame(Duration.seconds(duration),
new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR),
new KeyValue(arc.startAngleProperty(),
angle + 45 + control.getStartingAngle(),
Interpolator.LINEAR));
frames[1] = new KeyFrame(Duration.seconds(duration + 0.4),
new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR),
new KeyValue(arc.startAngleProperty(),
angle + 90 + control.getStartingAngle(),
Interpolator.LINEAR));
frames[2] = new KeyFrame(Duration.seconds(duration + 0.7),
new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR),
new KeyValue(arc.startAngleProperty(),
angle + 135 + control.getStartingAngle(),
Interpolator.LINEAR));
frames[3] = new KeyFrame(Duration.seconds(duration + 1.1),
new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR),
new KeyValue(arc.startAngleProperty(),
angle + 435 + control.getStartingAngle(),
Interpolator.LINEAR),
new KeyValue(arc.strokeProperty(), color, Interpolator.EASE_BOTH));
return frames;
}
示例4: CenterTransition
public CenterTransition(Node contentContainer, Node overlay) {
super(contentContainer, new Timeline(
new KeyFrame(Duration.ZERO,
new KeyValue(contentContainer.scaleXProperty(), 0, Interpolator.LINEAR),
new KeyValue(contentContainer.scaleYProperty(), 0, Interpolator.LINEAR),
new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
),
new KeyFrame(Duration.millis(1000),
new KeyValue(contentContainer.scaleXProperty(), 1, Interpolator.EASE_OUT),
new KeyValue(contentContainer.scaleYProperty(), 1, Interpolator.EASE_OUT),
new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH)
)));
// reduce the number to increase the shifting , increase number to reduce shifting
setCycleDuration(Duration.seconds(0.4));
setDelay(Duration.seconds(0));
}
示例5: HorizontalTransition
public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) {
super(contentContainer, new Timeline(
new KeyFrame(Duration.ZERO,
new KeyValue(contentContainer.translateXProperty(),
(contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())
* (leftDirection? -1 : 1), Interpolator.LINEAR),
new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
),
new KeyFrame(Duration.millis(1000),
new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT)
)));
// reduce the number to increase the shifting , increase number to reduce shifting
setCycleDuration(Duration.seconds(0.4));
setDelay(Duration.seconds(0));
}
示例6: VerticalTransition
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) {
super(contentContainer, new Timeline(
new KeyFrame(Duration.ZERO,
new KeyValue(contentContainer.translateYProperty(),
(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())
* (topDirection? -1 : 1), Interpolator.LINEAR),
new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
),
new KeyFrame(Duration.millis(1000),
new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT)
)));
// reduce the number to increase the shifting , increase number to reduce shifting
setCycleDuration(Duration.seconds(0.4));
setDelay(Duration.seconds(0));
}
示例7: createTimeline
private Timeline createTimeline(final TabHeaderSkin tabRegion, final Duration duration, final double endValue,
final EventHandler<ActionEvent> func) {
Timeline timeline = new Timeline();
timeline.setCycleCount(1);
KeyValue keyValue = new KeyValue(tabRegion.animationTransition, endValue, Interpolator.LINEAR);
timeline.getKeyFrames().clear();
timeline.getKeyFrames().add(new KeyFrame(duration, keyValue));
timeline.setOnFinished(func);
return timeline;
}
示例8: MoveAnimation
public MoveAnimation(Region node, Double duration, Double endX, Double endY) {
slideX = new Timeline(
new KeyFrame(Duration.seconds(0), new KeyValue(node.layoutXProperty(), node.getLayoutX(), Interpolator.EASE_BOTH)),
new KeyFrame(Duration.seconds(duration), new KeyValue(node.layoutXProperty(), endX, Interpolator.EASE_BOTH))
);
slideY = new Timeline(
new KeyFrame(Duration.seconds(0), new KeyValue(node.layoutYProperty(), node.getLayoutY(), Interpolator.LINEAR)),
new KeyFrame(Duration.seconds(duration * 0.25), new KeyValue(node.layoutYProperty(), endY, Interpolator.LINEAR)),
new KeyFrame(Duration.seconds(duration * 0.75), new KeyValue(node.layoutYProperty(), endY, Interpolator.LINEAR))
);
}
示例9: createIndeterminateTimeline
@Override
protected void createIndeterminateTimeline() {
if (indeterminateTransition != null) {
clearAnimation();
}
double dur = 1;
ProgressIndicator control = getSkinnable();
final double w = control.getWidth() - (snappedLeftInset() + snappedRightInset());
indeterminateTransition = new Timeline(new KeyFrame(
Duration.ZERO,
new KeyValue(clip.scaleXProperty(), 0.0, Interpolator.EASE_IN),
new KeyValue(clip.translateXProperty(), -w/2, Interpolator.LINEAR)
),
new KeyFrame(
Duration.seconds(0.5* dur),
new KeyValue(clip.scaleXProperty(), 0.4, Interpolator.LINEAR)
),
new KeyFrame(
Duration.seconds(0.9 * dur),
new KeyValue(clip.translateXProperty(), w/2, Interpolator.LINEAR)
),
new KeyFrame(
Duration.seconds(1 * dur),
new KeyValue(clip.scaleXProperty(), 0.0, Interpolator.EASE_OUT)
));
indeterminateTransition.setCycleCount(Timeline.INDEFINITE);
}
示例10: createTimeline
private Timeline createTimeline(final TabHeaderSkin tabRegion, final Duration duration, final double endValue, final EventHandler<ActionEvent> func) {
Timeline timeline = new Timeline();
timeline.setCycleCount(1);
KeyValue keyValue = new KeyValue(tabRegion.prefWidth, endValue, Interpolator.LINEAR);
timeline.getKeyFrames().clear();
timeline.getKeyFrames().add(new KeyFrame(duration, func, keyValue));
return timeline;
}
示例11: KeyFrameValue
public KeyFrameValue(T value) {
this(value, Interpolator.LINEAR);
}
示例12: toFxInterpolator
@Override
public Interpolator toFxInterpolator() {
return Interpolator.LINEAR;
}
示例13: initGraphics
private void initGraphics() {
double center = PREFERRED_WIDTH * 0.5;
double radius = PREFERRED_WIDTH * 0.45;
circle = new Circle();
circle.setCenterX(center);
circle.setCenterY(center);
circle.setRadius(radius);
circle.getStyleClass().add("indicator");
circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
circle.setStrokeDashOffset(dashOffset.get());
circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);
arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
arc.getStyleClass().add("indicator");
indeterminatePane = new StackPane(circle);
indeterminatePane.setVisible(false);
progressPane = new Pane(arc);
progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);
getChildren().setAll(progressPane, indeterminatePane);
// Setup timeline animation
KeyValue kvDashOffset_0 = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
KeyValue kvDashOffset_50 = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
KeyValue kvDashOffset_100 = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_0 = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_50 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
KeyValue kvRotate_0 = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
KeyValue kvRotate_100 = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);
KeyFrame kf0 = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
KeyFrame kf1 = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
KeyFrame kf2 = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);
timeline.setCycleCount(Animation.INDEFINITE);
timeline.getKeyFrames().setAll(kf0, kf1, kf2);
// Setup additional pane rotation
indeterminatePaneRotation = new RotateTransition();
indeterminatePaneRotation.setNode(indeterminatePane);
indeterminatePaneRotation.setFromAngle(0);
indeterminatePaneRotation.setToAngle(-360);
indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
indeterminatePaneRotation.setDuration(new Duration(4500));
}
示例14: createTransition
private void createTransition() {
final Paint initialColor = arc.getStroke();
if (initialColor == null) {
arc.setStroke(blueColor);
}
KeyFrame[] blueFrame = getKeyFrames(0, 0, initialColor == null ? blueColor : initialColor);
KeyFrame[] redFrame = getKeyFrames(450, 1.4, initialColor == null ? redColor : initialColor);
KeyFrame[] yellowFrame = getKeyFrames(900, 2.8, initialColor == null ? yellowColor : initialColor);
KeyFrame[] greenFrame = getKeyFrames(1350, 4.2, initialColor == null ? greenColor : initialColor);
KeyFrame endingFrame = new KeyFrame(Duration.seconds(5.6),
new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR),
new KeyValue(arc.startAngleProperty(),
1845 + control.getStartingAngle(),
Interpolator.LINEAR));
if (timeline != null) {
timeline.stop();
timeline.getKeyFrames().clear();
}
timeline = new Timeline(blueFrame[0],
blueFrame[1],
blueFrame[2],
blueFrame[3],
redFrame[0],
redFrame[1],
redFrame[2],
redFrame[3],
yellowFrame[0],
yellowFrame[1],
yellowFrame[2],
yellowFrame[3],
greenFrame[0],
greenFrame[1],
greenFrame[2],
greenFrame[3],
endingFrame);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setDelay(Duration.ZERO);
}
示例15: initGraphics
private void initGraphics() {
stops = new Stop[] {
new Stop(0.0, Color.rgb(0, 243, 0, 0.0)),
new Stop(0.8, Color.rgb(0, 243, 0, 0.0)),
new Stop(0.85, Color.rgb(0, 243, 0, 0.2)),
new Stop(1.0, Color.rgb(0, 243, 0, 0.75))
};
poiStops = new Stop[] {
new Stop(0.0, Color.WHITE),
new Stop(0.4, Color.WHITE),
new Stop(0.4, getRadarColorAsColor()),
new Stop(1.0, Color.TRANSPARENT)
};
background = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
backgroundCtx = background.getGraphicsContext2D();
ring1 = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.04);
ring1.getStyleClass().add("line");
ring2 = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.12);
ring2.getStyleClass().add("line");
ring3 = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.23);
ring3.getStyleClass().add("line");
ring4 = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.34);
ring4.getStyleClass().add("line");
ring5 = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.45);
ring5.getStyleClass().add("line");
verLine = new Line(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.05, PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.95);
verLine.getStyleClass().add("line");
horLine = new Line(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.95, PREFERRED_HEIGHT * 0.5);
horLine.getStyleClass().add("line");
poiCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
poiCtx = poiCanvas.getGraphicsContext2D();
beamGradient = new ConicalGradient(new Point2D(PREFERRED_WIDTH * 0.9 * 0.5, PREFERRED_HEIGHT * 0.9 * 0.5), true, 0, stops);
beam = new ImageView(beamGradient.getImage(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.9));
beam.relocate(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.05);
beam.setMouseTransparent(true);
beam.setVisible(isBeamVisible());
KeyValue kvStart = new KeyValue(beam.rotateProperty(), 0, Interpolator.LINEAR);
KeyValue kvStop = new KeyValue(beam.rotateProperty(), 360, Interpolator.LINEAR);
KeyFrame kfStart = new KeyFrame(Duration.ZERO, kvStart);
KeyFrame kfStop = new KeyFrame(Duration.millis(ROTATION_TIME_IN_MS), kvStop);
timeline = new Timeline();
timeline.getKeyFrames().addAll(kfStart, kfStop);
timeline.setCycleCount(-1);
pane = new Pane();
pane.getStyleClass().add("background");
pane.getChildren().setAll(background, ring1, ring2, ring3, ring4, ring5, verLine, horLine, poiCanvas, beam);
getChildren().setAll(pane);
}