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

Rendering is stalled if a repeating KeyFrame action takes longer than its specified duration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • fx2.0
    • fx1.0
    • javafx

      It is a regression in new API.

      Run the following sample:
      ----------------------------------------------------------------------------------------------------------------------------
      import javafx.stage.*;
      import javafx.scene.*;
      import javafx.scene.shape.*;
      import javafx.scene.paint.*;

      import java.lang.Math;
      import javafx.animation.Timeline;
      import javafx.animation.KeyFrame;

      class Particle{
          public var x:Number;
          public var y:Number;
      }

      class BrownianMotion extends CustomNode{

          public var particles: Particle[];

          public override function create (): Node {
              return Group{
                  content:
                      for (particle in particles)
                      Circle{
                          centerX: bind particle.x
                          centerY: bind particle.y
                          radius: 2
                          fill: Color.BLACK
                      }
              }
          }

          public function run(){
              var dx = 6.0;
              for (particle in particles){
                  particle.x += Math.random() * dx - dx / 2;
                  particle.y += Math.random() * dx - dx / 2;
              }


          }

      }

      var d = 400;
      var N = 50;

      var brownianMotion = BrownianMotion{
          particles:
              for (i in [1..N])
              Particle{
                  x: Math.random() * d
                  y: Math.random() * d
              }
      }

      Timeline {
          repeatCount: Timeline.INDEFINITE
          keyFrames : [
              KeyFrame {
                  time : 16ms
                  action: function() {
                      brownianMotion.run();
                  }
              }
          ]
      }.play();

      Frame{
          title: "Brownian Motion"
          width: d
          height: d

          closeAction: function () { java.lang.System.exit(0); }

          scene: Scene{
              content: brownianMotion
          }
          visible: true
      }
      ----------------------------------------------------------------------------------------------------------------------------

      The frame hangs.

            kcr Kevin Rushforth
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: