mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
lerp the artwork theme every frame instead of 24 quantized steps
This commit is contained in:
@@ -12,12 +12,9 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.graphics.lerp
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
const val ARTWORK_THEME_TRANSITION_MS = 600
|
||||
|
||||
private const val TRANSITION_STEPS = 24
|
||||
|
||||
@Composable
|
||||
internal fun baseArtworkColors(): ArtworkColors {
|
||||
val scheme = MaterialTheme.colorScheme
|
||||
@@ -61,7 +58,7 @@ fun rememberAnimatedArtworkColors(
|
||||
}
|
||||
|
||||
if (from === to) return to
|
||||
val fraction = (progress.value * TRANSITION_STEPS).roundToInt() / TRANSITION_STEPS.toFloat()
|
||||
val fraction = progress.value
|
||||
return remember(from, to, fraction) { lerpArtworkColors(from, to, fraction) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user