0

I currently have the following problem:

I have created a narrowcasting client for in a shop, which runs on a Raspberry Pi 2B model. Specs: Quad-core 900MHz ARM Cortex A7-processor (BCM2836 chipset), 1024MB RAM LPDDR2 and 16GB MicroSD is of class 10.

I have installed the latest JDK and extended it with the JavaFX packages (as stated in the first answer here). JavaFX is running now, so that should be fine.

However, when I try to run my application, the animations run very slow (see this video). I am using the code below for the animations:

public void initImagesTransitions() {

    EventHandler<ActionEvent> fadeIn = event -> {

        TranslateTransition in = new TranslateTransition(Duration.seconds(1), imageHolder);
        in.setFromY(-(SystemUtils.getScreenHeight()+100));
        in.setToY(-80);
        in.setCycleCount(1);
        in.play();

        imageHolder.setVisible(true);

    };

    EventHandler<ActionEvent> zoomIn = event -> {

        ScaleTransition st = new ScaleTransition(Duration.millis(5000), imageHolder);
        st.setByX(0.8f);
        st.setByY(0.8f);
        st.setCycleCount(1);
        st.play();

    };

    EventHandler<ActionEvent> fadeOut = event -> {

        TranslateTransition out = new TranslateTransition(Duration.seconds(1), imageHolder);
        out.setToY(500+SystemUtils.getScreenHeight());
        out.setCycleCount(1);
        out.play();

        out.setOnFinished(e -> imageHolder.setVisible(false));

    };

    Timeline timeline = new Timeline(
        new KeyFrame(Duration.ZERO, fadeIn),
        new KeyFrame(Duration.seconds(3), zoomIn),
        new KeyFrame(Duration.seconds(19), fadeOut)
    );

    timeline.playFromStart();

}

So nothing special there in my opinion. The Raspberry Pi is only using 30% CPU, so this is also unclear to me. The only other thing running in the background is a like-checker which communicates with my server API every minute.

Anyone any clue on why the animations are slow?

Any help is greatly appreciated!

Community
  • 1
  • 1
bashoogzaad
  • 4,611
  • 8
  • 40
  • 65

1 Answers1

2

Just brainstorming here.

Have you tried toying with -Dprism.order= ... settings? Like =sw or =j2d?

or increase vram on your PI?

(also this does seem relevant: javafx-very-slow-on-raspberry-pi? )

Community
  • 1
  • 1
el_chupacabra
  • 169
  • 1
  • 2
  • 9
  • Thanks for you answer! I will try these suggestions. The link doesnt seem to be relevant, because I use the correct JavaFX package. – bashoogzaad Feb 19 '16 at 12:09
  • Using j2d the animations are much smoother, thank you for that! However, are the more settings for -Dprism.order and where to find them? – bashoogzaad Feb 19 '16 at 12:16
  • Also increased the VRAM in config, 128MB is much better and still enough processing capabilities! Thanks for this answer once again! – bashoogzaad Feb 19 '16 at 12:40