Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.mikhaellopez:rxanimation

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.mikhaellopez:rxanimation

Simple way to animate your views on Android with Rx

  • 2.1.1
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

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'

:warning: 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

PropertiesView to CompletableRxAnimation.from(view)
alphaalphaalpha
translationXtranslationXtranslationX
translationYtranslationYtranslationY
translation X + Ytranslation(X, Y)translation(X, Y)
scaleXscaleXscaleX
scaleYscaleYscaleY
scale X = Yscalescale
rotationrotationrotation
rotationXrotationXrotationX
rotationYrotationYrotationY
Xxx
Yyy
Zzz
X + Y + Zxyzxyz
backgroundColorbackgroundColorbackgroundColor
widthwidthwidth
heightheightheight
width + heightresizeresize
ValueAnimatorstartstartValueAnimator
ViewPropertyAnimatoranimate-

Custom Properties

View to CompletableRxAnimation.from(view)
rangeFloatToCompletablerangeFloat
rangeIntToCompletablerangeInt

Smart function

AnimationView to CompletableRxAnimation.from(view)
alpha=1ffadeInfadeIn
alpha=0ffadeOutfadeOut
shakeshakeshake
presspresspress
texttexttext

:information_source: 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.

FAQs

Package last updated on 29 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc