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

Interpolator recalculates target on each iteration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx1.2.1
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
      None

      Description

      It is not only a usablity problem, but rather a performace issue.

      Compile and run the following example.
      Click somewhere inside and you'll see
      that right side color flicks unexpectedly.

      ========== SOURCE ==========
      import javafx.animation.Timeline;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;
      import javafx.util.Math.random;

      var timer: Timeline on replace old {
        old.stop();
        timer.playFromStart();
      }

      var c1 = Color.BLUE;
      var c2 = Color.BLUE;

      def w: Number = bind stage.scene.width / 2;
      def h: Number = bind stage.scene.height;

      def stage: Stage = Stage {
        title: "JavaFX test"
        scene: Scene {
          width: 640
          height: 480
          content: Group {
            onMouseClicked: function (event) {
              def color = Color.color(random(), random(), random());
              timer = Timeline {
                keyFrames: at (1s) {
                  c1 => color;
                  c2 => Color.color(random(), random(), random());
                }
              }
            }
            content: [
              Rectangle { width: bind w height: bind h fill: bind c1 }
              Rectangle { width: bind w height: bind h fill: bind c2 x: bind w }
            ]
          }
        }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              malenkov Sergey Malenkov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: