Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8095698

[Decora] Render bug animating over node with lighting effect

    XMLWordPrintable

Details

    Description

      This simple animation of a path node over a rect node with lighting effect leaves a trail of rendering artifacts.

      import javafx.animation.RotateTransition;
      import javafx.application.Application;
      import javafx.scene.*;
      import javafx.scene.effect.*;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.*;
      import javafx.stage.Stage;
      import javafx.util.Duration;

      public class DrawTurd extends Application {

      public void start(Stage aStage)
      {
          // Creat background rect with lighting effect
          Rectangle rect = new Rectangle(0,0,500,400); rect.setFill(Color.YELLOW);
          Light.Distant light = new Light.Distant(); light.setAzimuth(60); light.setElevation(120);
          Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(10);
          rect.setEffect(lighting);
          
          // Create foreground path triangle with rotation transition animation
          Path path = new Path();
          path.getElements().add(new MoveTo(100,100)); path.getElements().add(new LineTo(180,180));
          path.getElements().add(new LineTo(260,100)); path.getElements().add(new ClosePath());
          path.setFill(Color.RED); path.setStroke(Color.BLACK);
          RotateTransition rt = new RotateTransition(Duration.millis(3000), path);
          rt.setByAngle(180); rt.setCycleCount(4); rt.setAutoReverse(true); rt.play();
         
          // Create group, add nodes, set scene root, show stage
          Group group = new Group(rect, path);
          aStage.setScene(new Scene(group));
          aStage.show();
      }

      }

      Attachments

        Issue Links

          Activity

            People

              flar Jim Graham
              jmartinjfx Jeff Martin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: