transitioner

A library for dynamic view-to-view transitions

Github stars Tracking Chart

logo

License: MIT Download Kotlin Twitter URL

Transitioner provides easy, dynamic and adjustable animations between two views with nested children.

App design feature here.

Usage

First you need to create a Transitioner object containing your original and ending views:

val transition = Transitioner(original_view, ending_view)

The view pairs must have matching "tag" attributes so that they can be bound together:

<ConstraintLayout
        android:id="@+id/original_view"
        android:tag="constrView"
        ...>

        <TextView
            android:id="@+id/text"
            android:tag="firstView"
            .../>
</ConstraintLayout>

<ConstraintLayout
        android:id="@+id/ending_view"
        android:tag="constrView"
        android:visibility="invisible"
        ...>

        <EditText
            android:id="@+id/text3"
            android:tag="firstView"
            .../>
 </ConstraintLayout>

I recommend you hide the second view layout, since it's only used as a placeholder for the end destination.
The views can be of any type, you can mix and match them, the two layouts can have a different number of views and nested layouts are 100% supported. The only things to keep in mind are:

  • all views which you would want to match together must have the same tag attribute in both layouts

  • all unmatched views will remain at their original place inside the original layout

  • the second layout is just a placeholder. It doesn't hold any logic, it only shows where the original layout should move to.

Basic Usage

 transition.setProgress(0.5f)
 //or
 transition.setProgress(50)

Additional methods and tweaks

transition.duration = 500

transition.interpolator = AccelerateDecelerateInterpolator()

transition.animateTo(percent = 0f)

transition.onProgressChanged {
//triggered on every progress change of the transition
    seekBar.progress = (it * 100).toInt()
    }
    
val progress: Float = transition.currentProgress

Here is a preview of a simple application made using this library

Preview

This effect can be reproduced by placing the "Transitioner.setProgress(Float)" function inside a onTouch or a onProgressChanged method.


Download

Gradle

dependencies {
  compile 'bg.devlabs.transitioner:transitioner:<latest_version>'
}

Maven

<dependency>
  <groupId>bg.devlabs.transitioner</groupId>
  <artifactId>transitioner</artifactId>
  <version>latest_version</version>
  <type>pom</type>
</dependency>

Manually

You can also manually download the library class and use it in your application.


Compatibility

Minimum Android SDK: API level 19


Author

Radoslav Yankov @Radoslav_Y


Getting help

If you spot a problem you can open an issue on the Github page, or alternatively, you can tweet us at @devlabsbg


License

Transitioner is released under the MIT License.

Main metrics

Overview
Name With Ownerdev-labs-bg/transitioner
Primary LanguageKotlin
Program languageKotlin (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2017-12-08 07:39:39
Pushed At2020-04-24 14:12:27
Last Commit At2020-04-14 03:01:46
Release Count2
Last Release Name1.4 (Posted on )
First Release Name1.3 (Posted on )
用户参与
Stargazers Count2.1k
Watchers Count64
Fork Count143
Commits Count36
Has Issues Enabled
Issues Count7
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private