https://kotlinlang.org logo
#compose
Title
# compose
t

Thiago

03/26/2020, 5:22 PM
s

Sean McQuillan [G]

03/26/2020, 5:42 PM
That looks nice!
😄 1
Shared it with the animation lead, this is cool. One question, why did you snapTo(0f) here (mostly looking to learn how you used the API) https://github.com/programadorthi/compose-weather-forecast/blob/master/app/src/main/java/br/com/programadorthi/compose/composables/animated_title.kt#L34
Also any other feedback about these APIs?
t

Thiago

03/26/2020, 10:52 PM
I have used snapTo(0f) because I need reset the animation value when it ends. When top text is completely visible, I need reset it to the origin position and show the bottom text with the current title. I confess that there is better ways to use animation APIs and I studying to improve the sample. Feedbacks? Well, about animations I would like to see, if its makes sense, a chainned Easing where I can combine Easing between them. Classes that inherited from Easing typealias would have a property to another Easing creating a chainned effect where the topmost Easing result will be combined with bottommost. You can see below where I created a TweenEasing and applied to it a IntervalEasing. And in IntervalEasing I applied a CubicBezierEasing (
easeInOut
). Unfortunaly, CubicBezierEasing doesn't have a easing field to keep going with chainned easing. https://github.com/programadorthi/compose-weather-forecast/blob/02884a698153a7cd0b81df7472bee26ca2e92829/app/src/main/java/br/com/programadorthi/compose/composables/forecast_content.kt#L94 https://github.com/programadorthi/compose-weather-forecast/blob/02884a698153a7cd0b81df7472bee26ca2e92829/app/src/main/java/br/com/programadorthi/compose/helpers/animations.kt#L34
s

Sean McQuillan [G]

03/26/2020, 11:05 PM
Awesome, thank you – reset makes sense (it's good to see how the APIs are being used!). Gonna get the feedback about chained easing in future animation design discussions. Thanks!
👍 1
d

Doris Liu

03/26/2020, 11:22 PM
@Thiago Super cool app! I loved customized easing - IntervalEasing. 🙂 Out of curiosity, for the easing chaining, are you looking to literally chain two easing curves together? Are you concerned with the discontinuity as it moves from the end of one easing curve to the beginning of another, or is that an intended look?
Or do you always chain an easing out with an easing in, to ensure the continuous rate of change?
t

Thiago

03/27/2020, 12:08 PM
@Doris Liu thanks you for the compose. Answering your curiosity, if I understood well, they're together in declaration but sequential in execution. If we have 3 easing, X, Y, Z where X depends on Y that depends on Z, the result would be:
Copy code
X(
  easing = Y(
    easing = Z(
      easing ... and so on
    )
  )
)

// here is the flow when a invoke X with animation value
fx = X computation * fy(fraction)
fy = Y computation * fz(fraction)
fz = Z computation * fraction
Because each easing class have a typealias Easing field, we can create infinite easing combinations I hope have answered your curiosity.
4 Views