Search in sources :

Example 1 with ColorComponent

use of com.almasb.fxgl.entity.component.ColorComponent in project FXGL by AlmasB.

the class AnimColorSample method initGame.

@Override
protected void initGame() {
    Rectangle playerView = new Rectangle(40, 40);
    Entity player = Entities.builder().at(100, 100).viewFromNode(playerView).with(new ColorComponent()).buildAndAttach();
    playerView.fillProperty().bind(player.getComponent(ColorComponent.class).valueProperty());
    Entities.animationBuilder().duration(Duration.seconds(2)).repeat(4).color(player).fromColor(Color.AQUA).toColor(Color.BURLYWOOD).buildAndPlay();
}
Also used : Entity(com.almasb.fxgl.entity.Entity) ColorComponent(com.almasb.fxgl.entity.component.ColorComponent) Rectangle(javafx.scene.shape.Rectangle)

Aggregations

Entity (com.almasb.fxgl.entity.Entity)1 ColorComponent (com.almasb.fxgl.entity.component.ColorComponent)1 Rectangle (javafx.scene.shape.Rectangle)1