• Stars
    star
    590
  • Rank 75,794 (Top 2 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple way to animate your views on Android with Rx πŸš€

title

Platform API Maven Central Twitter

This is an Android library to make a simple way to animate your views on Android with Rx.

Android app on Google Play

USAGE

Add RxAnimation library under Rx3 with Gradle:

implementation 'com.mikhaellopez:rxanimation:2.1.1'

⚠️ If you use Rx2 you need to implement the following version (just on jcenter):

implementation 'com.mikhaellopez:rxanimation:1.0.0'

KOTLIN

sample

  • Animate your views and handle it in Completable. For example alpha() and resize():
view1.alpha(1f)
    .andThen(view2.resize(100, 100))

sample

  • If you want to apply animation in the same time you can used RxAnimation.together():
RxAnimation.together(
    view1.fadeIn(),
    view1.translation(20f, 30f),
    view2.backgroundColor(
        ContextCompat.getColor(this, R.color.accent),
        ContextCompat.getColor(this, R.color.primary)
    ),
    view2.resize(100, 100)
)

sample

  • If you want to apply animation one by one you can used RxAnimation.sequentially() instead of multi andThen():
RxAnimation.sequentially(
    view1.fadeIn(),
    view1.translation(20f, 30f),
    view2.backgroundColor(
        ContextCompat.getColor(this, R.color.accent),
        ContextCompat.getColor(this, R.color.primary)
    ),
    view2.resize(100, 100)
)

sample

  • You can also used RxAnimation.from(view) if you want to update multi properties one by one in the same view:
RxAnimation.from(view)
    .fadeIn()
    .translation(20f, 30f)
    .backgroundColor(
        ContextCompat.getColor(this, R.color.accent),
        ContextCompat.getColor(this, R.color.primary)
    )
    .resize(100, 100)

sample

  • You can also use the range() function to animate a change on a custom property:
(4f to 20f).rangeFloatToCompletable { 
    circularImageView.borderWidth = it 
}

// or

RxAnimation.from(circularImageView)
    .rangeFloat(4f, 20f) { circularImageView?.borderWidth = it }
  • Use reverse properties to back to the initial value in all methods:
view.fadeIn(reverse = true)
  • If you want to repeat an animation you can use the native method repeat from Rx like this:
RxAnimation.from(view)
    .fadeIn()
    .shake()
    .fadeOut()
    .repeat(NB_REPEAT)
    .subscribe()

ALL PROPERTIES

Default

Properties View to Completable RxAnimation.from(view)
alpha alpha alpha
translationX translationX translationX
translationY translationY translationY
translation X + Y translation(X, Y) translation(X, Y)
scaleX scaleX scaleX
scaleY scaleY scaleY
scale X = Y scale scale
rotation rotation rotation
rotationX rotationX rotationX
rotationY rotationY rotationY
X x x
Y y y
Z z z
X + Y + Z xyz xyz
backgroundColor backgroundColor backgroundColor
width width width
height height height
width + height resize resize
ValueAnimator start startValueAnimator
ViewPropertyAnimator animate -

Custom Properties

View to Completable RxAnimation.from(view)
rangeFloatToCompletable rangeFloat
rangeIntToCompletable rangeInt

Smart function

Animation View to Completable RxAnimation.from(view)
alpha=1f fadeIn fadeIn
alpha=0f fadeOut fadeOut
shake shake shake
press press press
text text text

ℹ️ All the functions have duration: Long, interpolator: TimeInterpolator, startDelay: Long and reverse: Boolean properties.

SUPPORT ❀️

Find this library useful? Support it by joining stargazers for this repository ⭐️
And follow me for my next creations πŸ‘

LICENCE

RxAnimation by Lopez Mikhael is licensed under a Apache License 2.0.

More Repositories

1

CircularImageView

Create circular ImageView in Android in the simplest way possible
Kotlin
1,949
star
2

CircularProgressBar

Create circular ProgressBar in Android β­•
Kotlin
1,698
star
3

CircularFillableLoaders

Realize a beautiful circular fillable loaders to be used for splashscreen 🌊
Java
1,222
star
4

BestAndroidGists

Find best Android Gist πŸ”₯
890
star
5

AndroidWebServer

Android Web Server (NanoHttpd)
Java
433
star
6

CleanRxArchitecture

Clean Rx Kotlin Architecture sample on GitHub Api πŸš€
Kotlin
387
star
7

LazyDatePicker

LazyDatePicker an alternative to the native Android Date Picker πŸ“…
Java
372
star
8

RateBottomSheet

To help to promote your android app by prompting users to rate your app in a BottomSheet ⭐️
Kotlin
308
star
9

GradientView

Create gradient view in Android in the simplest way possible 🌈
Kotlin
197
star
10

HFRecyclerView

Add Header and/or Footer in your RecyclerView in the simplest way possible.
Kotlin
170
star
11

CircleView

Create circular view in android (change color, border & shadow) ⚫
Kotlin
165
star
12

Biometric

The easiest way is to use the new version of Biometric under AndroidX πŸ”’
Kotlin
140
star
13

PokeCardCompose

PokeCard Compose is a demo app 100% write in Compose, Flow and Koin based on MVI Clean Architecture 🐱⚑️
Kotlin
115
star
14

SaveInsta

Example dynamic update of your theme based on a main color
Java
85
star
15

AutoScrollTextView

Sample Android application show how to set auto scroll in text view in android.
Java
51
star
16

FavoriteAndroidLibrary

My Farorite Android Library
49
star
17

MyToast

Custom Toast on Android
Java
39
star
18

DualShot

With DualShot you take two photos with the front and the back camera, and share both of them in a single image.
Java
23
star
19

WebSideMVC

Structure MVC for Web Side in PHP
PHP
1
star