Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ImageView animation with Image sprite sheet vs Image collection

jmartApr 29 2012 — edited Apr 30 2012
Hello,

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.

thanks
jose
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2012
Added on Apr 29 2012
3 comments
215 views