An RxJAva2 binding for android Animator
RxAnimator.ofFloat(view, "translationY", 0, 300).animationDuration(500)
.flatMap(anim -> RxAnimator.ofFloat(view, "translationX", 0, 300))
.subscribe(anim -> {});
RxAnimator
contains the same methods as ValueAnimator`
.animationDuration(long)
.animationStartDelay(long)
.animationInterpolator(interpolator)
.animationEvaluator(evaluator)
...
(Using RxBindings for the click observable)
RxView.clicks(view)
.flatMap(animation ->
Observable.zip(
RxAnimator.ofFloat(view, "scaleX", 5),
RxAnimator.ofFloat(view, "scaleY", 5),
RxAnimator.ofFloat(view, "translationY", 300),
RxAnimator.ofFloat(view, "translationX", 200),
(a, a2, a3, a4) -> a
)
)
.flatMap(animation ->
Observable.zip(
RxAnimator.ofFloat(view, "scaleX", 1),
RxAnimator.ofFloat(view, "scaleY", 1),
RxAnimator.ofFloat(view, "translationX", 0),
RxAnimator.ofFloat(view, "translationY", 0),
(a, a2, a3, a4) -> a
)
)
.subscribe(animation -> {});
By default the observable submits when the animator ends
You can configure it using .animationTriggerEvent(Event.START / Event.END / Event.CANCEL / EVENT.RESTART)
compile 'com.github.florent37:rxanimator:1.0.0'
Author: Florent Champigny
![Follow me on Google+](https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/gplus.png)
![Follow me on Twitter](https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/twitter.png)
![Follow me on LinkedIn](https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/linkedin.png)
#License
Copyright 2017 florent37, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.