GithubHelp home page GithubHelp logo

dev-labs-bg / transitioner Goto Github PK

View Code? Open in Web Editor NEW
2.1K 65.0 142.0 21.84 MB

A library for dynamic view-to-view transitions

License: MIT License

Kotlin 100.00%
android kotlin view transition animation transitioner dynamic library android-library keyframe

transitioner's Introduction

logo

License: MIT Download 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

Manually

The recommended way to download is to copy the single library class file and use it in your application.

Gradle

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

Getting help

Dev Labs @devlabsbg

Radoslav Yankov @rado__yankov

Under MIT License.

transitioner's People

Contributors

radoyankov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transitioner's Issues

Benefits ?

Hey,
What are the main benefits for using this library instead of this

How can I make a swipe transition?

Hello!

I really like your library and I'm trying to develop a transition like the weather app on your Readme: how could I make an up/down swipe?

I've tried with this but the result is VERY BAD. Do you know where I can find some examples? Thanks.
var screenSize = size.y screen.setOnTouchListener { v, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { oldY = event.y true } MotionEvent.ACTION_MOVE -> { transition.setProgress((event.y - oldY)/screenSize) true } else -> { true } } }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.