3 Replies Latest reply on Apr 30, 2012 5:58 AM by MiPa

    ImageView animation with Image sprite sheet vs Image collection


      When doing animation of ImageViews I use an implementation that extends ImageView then utilizes a Timeline that changes the Image field at some Duration. I could post the code for it but I think the constructor of said implementation says it all.....
      public AnimatedImageView(int frameCount, Duration frameDelay, boolean infiniteLoop, ArrayList<Image> frames)
      ... I flip through the array of Images.

      I recently came across this article on Java Code Geeks, http://bit.ly/IkZg0U . The approach outlined in the article uses a sprite sheet and the setViewPort method of the managed ImageView.

      Taking into account that there will be dozens of these animated objects on screen at the same time, do you suspect a noticeable difference in performance between the two approaches? Which would you pick and why... or maybe you have a third approach?

      What I like about the sprite sheet approach is that it lessens the number HTTP requests needed to retrieve the Images.