orangy
animateColor
involving alpha. It goes from Color.White
to Color.Blue.copy(0.1f)
with a tween()
spec. Instead of linear transition from one appearance to another, it goes first to less transparent Color.Blue
pretty fast and then alpha catches up, resulting in the unexpected effect of a “hump” transition. Any ideas how to fix it? E.g. in browser similar transition effect between same colors works as expected. (Compose for Desktop, if it is important)orangy
orangy
val ColorToVectorPremultiplied: TwoWayConverter<Color, AnimationVector4D> =
TwoWayConverter(
convertToVector = { color -> AnimationVector4D(color.alpha, color.red * color.alpha, color.green * color.alpha, color.blue * color.alpha) },
convertFromVector = {
val alpha = it.v1.coerceIn(0f, 1f)
Color(
alpha = alpha,
red = it.v2.coerceIn(0f, 1f) / alpha,
green = it.v3.coerceIn(0f, 1f) / alpha,
blue = it.v4.coerceIn(0f, 1f) / alpha,
)
}
)
With converter like this it works as expected.orangy
orangy
Chris Sinco [G]
06/11/2022, 3:59 PM