JDK-8113170 : A simple animation is jerky
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-06-03
  • Updated: 2015-09-07
  • Resolved: 2012-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7-poolFixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Relates :  
Relates :  
Description
When I have a simple animation of a circle moving across the screen I get "jerks" about every 0.5 seconds.

Here is the code:

import javafx.animation.Interpolator;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;
 
public class SmoothMovementTest extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root, 800, 400, Color.WHITE);
        stage.setScene(scene);
 
        Circle circle = new Circle(50.0, Color.RED);
        circle.setCenterX(50.0);
        circle.setCenterY(200.0);
        root.getChildren().add(circle);
 
        TranslateTransition transition = new TranslateTransition(new Duration(5000.0), circle);
        transition.setToX(700.0);
        transition.setAutoReverse(true);
        transition.setCycleCount(10);
        transition.setInterpolator(Interpolator.LINEAR);
 
        stage.setVisible(true);
 
        transition.playFromStart();
    }
 
    public static void main(String[] args) {
        Application.launch(args);
    }
}

and here is some debug info:

Prism pipeline init order: d3d j2d 
Using openpisces for shapes, t2k for text rasterization
Using dirty region optimizations
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
(X)(1) D3D loading native lib
prism-d3d loaded.
[I] OS Version = OS_WINXP Pro
(I) CheckAdaptersInfo
(I) ------------------
(I) Adapter Ordinal  : 0
(I) Adapter Handle   : 0x10001
(I) Description      : NVIDIA GeForce 8400 GS   
(I) GDI Name, Driver : \\.\DISPLAY1, nv4_disp.dll
(I) Vendor Id        : 0x10de
(I) Device Id        : 0x06e4
(I) SubSys Id        : 0x0
(I) Driver Version   : 6.14.11.8250
[I] GUID             : {D7B71E3E-45A4-11CF-8A43-0B2000C2CB35}
(I) D3DPPLM::CheckDeviceCaps: adapter 0: Passed
(I) ------------------
(I) Adapter Ordinal  : 1
(I) Adapter Handle   : 0x10003
(I) Description      : NVIDIA GeForce 8400 GS   
(I) GDI Name, Driver : \\.\DISPLAY3, nv4_disp.dll
(I) Vendor Id        : 0x10de
(I) Device Id        : 0x06e4
(I) SubSys Id        : 0x0
(I) Driver Version   : 6.14.11.8250
[I] GUID             : {D7B71E3E-45A4-11CF-8A43-0B2000C2CB35}
(I) D3DPPLM::CheckDeviceCaps: adapter 1: Passed
(I) ------------------
(X)d3dEnabled =true
(X) Got class = class com.sun.prism.d3d.D3DPipeline
D3DPipeline:getInstance(), d3dEnabled=true
Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline
JavaFX: using com.sun.javafx.tk.quantum.QuantumToolkit
RESIZE: 811590258988782 w: 800 h: 400
(I) D3DContext::InitContext device 0
(I) D3DContext::ConfigureContext device 0
(I) D3DContext::ConfigureContext: successfully created device: 0
(I) D3DContext::InitDevice: device 0
(I) D3DContext::InitDevice: successfully initialized device 0
QuantumRenderer: shutdown
(E) call to JavaD3DResourceFactoryDummy
Comments
I have just tested this and I must say, I am very pleased. It is silky smooth. Thanks for fixing it. Nick.
19-01-2012

I tried this code in b08 and b09 The difference is really visible. Looks smooth now for me.
19-01-2012

Correct it will be in b09
16-01-2012

Great news that this has been fixed. I would like to test it. I've just downloaded 2.1 beta (b08) but don't see any difference. Will the fix be in the next beta?
16-01-2012

Fixed in p21-graphics b292 with this change set changeset: 15283:4ce4d30ab43d user: Morris Meyer <morris.meyer@sun.com> date: Thu Jan 12 22:17:45 2012 -0500 summary: RT-13660 PaintCollectorBehavior v07 - reviewed by Kevin R, Oleg S, Oleg M, Ekaterina P, Artem A, Kirill P, Chien Y, Brent C and many others
13-01-2012

Approved at 8/23 meeting
23-08-2011

SQE - OK to defer
23-08-2011

Thanks for the update.
22-08-2011

We are very close to getting a fix but it turns too risky for Presidio. We are have a hang in Ensemble which will require few more days of soak time. Will need to be targeted for Lombard.
19-08-2011

Is there any news on this (or the related) issue(s)? It's making part of my gui look really bad!
01-08-2011

This issue is not related to the animation library. I did a quick analysis. The variation how long the animation code takes is neglectable. But every now and then the gap between two pulses, the animation library receives from the runtime, is bigger. This is probably related to the linked issue. Below you can see some example output. The first number is the delta between two pulses, the second number is the time spend in animation code. Both numbers are given in nanoseconds. You will notice that usually the delta between two pulses is ~16ms, but sometimes it is ~32ms and once even ~48ms. I believe this is the cause of the jittering. 16076000: 101000 16034000: 113000 16068000: 96000 16163000: 101000 16110000: 98000 16039000: 93000 16130000: 101000 15989000: 104000 15992000: 133000 32253000: 119000 15974000: 100000 16149000: 116000 16063000: 86000 48137000: 105000 16040000: 105000 16087000: 135000 15975000: 102000 16199000: 96000 15830000: 98000 16161000: 101000 16120000: 102000 16132000: 101000 16041000: 94000 15986000: 97000 16194000: 116000 16031000: 94000 15997000: 106000 16121000: 93000 16151000: 143000 15950000: 96000 32044000: 94000 16143000: 102000 16026000: 82000 16095000: 76000
10-06-2011