google-developer-training / basic-android-kotlin-compose-training-woof

Apache License 2.0
55 stars 87 forks source link

Simple Animation with Jetpack Compose #100

Open rosie-i opened 4 months ago

rosie-i commented 4 months ago

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-woof-animation#0

In which task and step of the codelab can this issue be found? 6) Add animation

Describe the problem

You are first instructed to add .animateContentSize to the modifier:

Column(
   modifier = Modifier
       .animateContentSize()
)

This adds a default animation, which the codelab describes as 'so subtle that it is difficult to discern when you run the app'

But the animation you're then instructed to add is achieving exactly the same outcome as the code above:

animationSpec = spring(
               dampingRatio = Spring.DampingRatioNoBouncy,
               stiffness = Spring.StiffnessMedium
           )

The docs state that the default parameter for animation spec is spring(), and that spring() 's default parameters are dampingRatio = Spring.DampingRatioNoBouncy and stiffness = Spring.StiffnessMedium .

It makes sense to teach us how to use animationSpec to customise animations of course, but it's confusing to imply that we're going to add code which will result in a noticeably different animation when it's just explicitly coding in the default parameters.