use of com.almasb.fxgl.animation.Interpolators in project FXGL by AlmasB.
the class InterpolatorSample2 method initGame.
@Override
protected void initGame() {
int i = 0;
for (Interpolators interpolator : Interpolators.values()) {
Text t = getUIFactory().newText(interpolator.toString() + ":");
t.setFill(Color.BLACK);
Pane p = new Pane(t);
p.setTranslateY(i * 50 + 25);
Line line = new Line(0, i * 50, getWidth(), i * 50);
line.setStroke(Color.RED);
getGameScene().addUINodes(p, line);
Texture texture = DSLKt.texture("bird.png").toAnimatedTexture(2, Duration.seconds(0.5));
Entity bird = Entities.builder().at(100, i * 50).viewFromNode(texture).buildAndAttach();
Entities.animationBuilder().interpolator(interpolator.EASE_OUT()).duration(Duration.seconds(2)).repeatInfinitely().translate(bird).from(new Point2D(100, i * 50)).to(new Point2D(400, i * 50)).buildAndPlay();
i++;
}
}