Skip to content

Commit

Permalink
only do fading animation when more banners are present
Browse files Browse the repository at this point in the history
  • Loading branch information
Acivev committed Feb 6, 2025
1 parent 81e6735 commit 4c9b015
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/com/reco1l/osu/Banners.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,30 @@ class BannerSprite(private val banners: List<Banner>) : ExtendedSprite() {

init {
textureRegion = banners[currentBannerIndex].image
alpha = 0f
fadeIn(0.75f)
if (banners.size > 1) {
alpha = 0f
fadeIn(0.75f)
}
}


override fun onManagedUpdate(pSecondsElapsed: Float) {
if (banners.size > 1) {
if (elapsedTimeSinceLastChange > BANNER_DURATION) {
elapsedTimeSinceLastChange %= BANNER_DURATION

if (elapsedTimeSinceLastChange > BANNER_DURATION) {
elapsedTimeSinceLastChange %= BANNER_DURATION

currentBannerIndex++
currentBannerIndex %= banners.size
currentBannerIndex++
currentBannerIndex %= banners.size

val banner = banners[currentBannerIndex]
val banner = banners[currentBannerIndex]

fadeOut(0.5f).then {
textureRegion = banner.image
fadeIn(0.5f)
fadeOut(0.5f).then {
textureRegion = banner.image
fadeIn(0.5f)
}
}
elapsedTimeSinceLastChange += pSecondsElapsed
}
elapsedTimeSinceLastChange += pSecondsElapsed

super.onManagedUpdate(pSecondsElapsed)
}

Expand Down

0 comments on commit 4c9b015

Please sign in to comment.