AnimateTextUnit animates text unit values like sp
and em
. When the provided targetValue is
changed, the animation will run automatically. If there is already an animation in-flight when
targetValue changes, the on-going animation will adjust course to animate towards the new target value.
add maven central repo to your root settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
add the dependency to your module's build.gradle.kts
dependencies {
implementation("pro.jayeshseth.madifiers:animateTextUnitAsState:<version>")
}
val fontSize by animateTextUnitAsState (
targetValue = ...,
animationSpec = tween(...),
label = "...",
finishedListener = {}
)
Check Out Working Sample here