Reputation: 3167
I want to do an explosion animation with three different bitmaps representing different stages of the explosion I already have the bitmaps loaded, I tried using a for loop but the images get by too fast to see. I have this all in my surfaceview class, is there a way to properly carry out this function this sort of explosion image switching, or any pointers without the images flashing by so fast?
Upvotes: 1
Views: 3298
Reputation: 261
You just need to write
new ParticleSystem(this, numParticles, drawableResourceId, timeToLive)
.setSpeedRange(0.2f, 0.5f)
.oneShot(emitterview, numberOfParticles);
also add this dependency
dependencies {
compile 'com.plattysoft.leonids:LeonidsLib:1.3.1'
}
For more detail, Please refer this library. https://github.com/plattysoft/Leonids
Upvotes: 0
Reputation: 437
Drawable animation works, but you could also have a runnable that changes the bitmap, sleeps for some time, and then changes the bitmap again.
Its hacky, but depending on your situation, might be more convenient.
Upvotes: 0
Reputation: 651
It looks like you're interested in Drawable animation.
http://developer.android.com/guide/topics/graphics/drawable-animation.html
Upvotes: 1