import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.builders.*; import javafx.scene.effect.DropShadow; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class DropShadowBugTest extends Application { @Override public void start(Stage stage) throws Exception { Rectangle toAnimate; //It is necessary to enclose the animated rectangle with //a VBox that has the effect, to see the bug. VBox vBox = new VBoxBuilder() .children( toAnimate = new RectangleBuilder() .width(200) .height(50) .fill(Color.BLUE) .stroke(Color.BLACK) .build() ) .effect(new DropShadow()) .build(); //setup an AnchorPane to contain this VBox AnchorPane anchorPane = new AnchorPaneBuilder().children(vBox).build(); AnchorPane.setLeftAnchor(vBox, 10.0); AnchorPane.setTopAnchor(vBox, 10.0); stage.setScene(new SceneBuilder().root(anchorPane).height(300).width(240).build()); stage.setVisible(true); Timeline timeline = new TimelineBuilder() .keyFrames( new KeyFrame(Duration.valueOf(0), new KeyValue(toAnimate.heightProperty(), 50)), new KeyFrame(Duration.valueOf(600), new KeyValue(toAnimate.heightProperty(), 200)) ).build(); timeline.setAutoReverse(true); timeline.setCycleCount(-1); timeline.play(); } public static void main(String[] args) { Application.launch(DropShadowBugTest.class, null); } }