Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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