lopspower/RxAnimation

a little advise

for7GG opened this issue · 3 comments

this project is awesome!Good job!I have few questions:
1.please add repeat property,sometimes we need to repeat animations all the time
2.Add animation monitor
3.Reverse animation when animations done

Hi @jielundewode thx for you feedback,

  1. Repeat properties it's complicated to add because you can't repeat animation like alpha(1). If you repeat this animation nothing it's append because you try to set alpha from 1 to 1.

Nevertheless, you can use the function provided by Rx repeat this way:

RxAnimation.from(view)
    .fadeIn()
    .fadeOut()
    .repeat(NB_REPEAT)
    .subscribe()
  1. I am not sure I understood that point. If you need to recover the state of the animation (start / in progress / finish) it is precisely the flow of your Observable in Rx that gives it to you.

  2. This point is for me the most relevant. I think I'm going to add a property reverse: Boolean with the default value false to apply an animation and return to the original state at the end.

RxAnimation.from(view)
    .fadeIn(reverse = true)
    .subscribe()

There is however an important point to settle on the duration of the animation. Do you have to double the duration of the animation or keep the same to apply the first animation and the reverse?
In the previous example, the default animation duration is 300ms. With the reverse is applied fadeIn on 300ms and then the reverse on 300ms which gives us an animation of finally 600ms in total. Or do you have to divide the animation time by two: 150ms the first fadeIn and 150ms the reverse?

Reverse properties is now available on the last version:

implementation 'com.mikhaellopez:rxanimation:0.0.5'

You can used it like this:

view.fadeIn(reverse = true)

It uses the same properties as the main animation but returning to the default state in the same duration. The total time of the animation is doubled in the case of a reverse.

Okay,thanks