Created
January 3, 2022 16:44
-
-
Save IvanShafran/522cbc4cb9142e900c4a3f4f04768763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AnimatedGameObject( | |
private val bitmaps: List<Bitmap>, | |
private val duration: Long | |
) { | |
fun getBitmap(timeInMillis: Long): Bitmap { | |
val mod = timeInMillis % duration | |
val index = (mod / duration.toFloat()) * bitmaps.size | |
return bitmaps[index.toInt()] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment