Coder Social home page Coder Social logo

phoenix-626 / dynamic-motion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pranavpandey/dynamic-motion

0.0 0.0 0.0 6.25 MB

A library to provide additional functionality for Android MotionLayout.

Home Page: https://pranavpandey.org/dynamic-motion

License: Apache License 2.0

Java 100.00%

dynamic-motion's Introduction

Dynamic Motion

License Build Status Download

A library to provide additional functionality for MotionLayout on Android 4.3 (API 18) and above devices.

It has DynamicMotionLayout which has a built-in ViewPager to create parallax effects which will open a huge set of possibilities for the original MotionLayout.


Contents


Installation

It can be installed by adding the following dependency to your build.gradle file:

dependencies {
    implementation 'com.pranavpandey.android:dynamic-motion:0.4.0'
}

Usage

It is divided into 3 simple steps and whole layout can be configured by just using the xml files.

Replace

First, replace the original MotionLayout with DynamicMotionLayout in xml file.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>

Page count

Set page count for ViewPager to divide the transition between different pages.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:adm_pageCount="4"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>
// At runtime
dynamicMotionLayout.setPageCount(int, @Nullable ViewPager.OnPageChangeListener);

Motion scene

Add a motion scene and use KeyFrameSet and KeyAttribute to animate the views across different pages. Please check the sample for a demo scene.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:layoutDescription="@xml/motion_scene"
    app:adm_pageCount="4"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>

Author

Pranav Pandey

GitHub Follow on Twitter Donate via PayPal


License

Copyright 2018-2020 Pranav Pandey

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.

dynamic-motion's People

Contributors

pranavpandey avatar

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.