Skip to content

Commit

Permalink
Workaround bad color animtion in latest compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Chozzle committed Feb 28, 2021
1 parent 99885a6 commit 3988e6b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion compose-macos-theme/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
id("signing")
}

version = "0.3.0"
version = "0.3.1"
group = "io.github.chozzle"

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,9 @@ private class DefaultTextFieldColors(
else -> unfocusedIndicatorColor
}
return if (enabled) {
return if (interaction is FocusInteraction.Focus) {
animateColorAsState(
targetValue, keyframes {
targetValue.copy(alpha = 0f) at 0 with FastOutLinearInEasing
durationMillis = AnimationDuration
}
)
} else {
animateColorAsState(targetValue, tween(durationMillis = AnimationDuration))
}
// TODO: MacTheme: Tried keyframe animation here to start focus animation at 0% alpha, but there always
// seems to be 1 frame of of 100% alpha which ruins animation
animateColorAsState(targetValue, tween(durationMillis = AnimationDuration))
} else {
rememberUpdatedState(targetValue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ internal const val TextFieldId = "TextField"
internal const val PlaceholderId = "Hint"
internal const val LabelId = "Label"

private const val FlashAnimationDuration = 200
private const val FlashAnimationDuration = 150
internal const val AnimationDuration = 150
private const val PlaceholderAnimationDuration = 83
private const val PlaceholderAnimationDelayOrDuration = 67
Expand Down

0 comments on commit 3988e6b

Please sign in to comment.