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 }
]
}
}
}
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 }
]
}
}
}
- relates to
-
JDK-8109451 Animation interpolation takes shorter time than expected
-
- Closed
-