Git Product home page Git Product logo

playanimations's Introduction

PlayAnimations

A demo of various animation in latest PlayGames app using the Transition framework of Android.

Minimum SDK>21. This is not a backport of Transition Framework. This demo works above Lollipop only.

http://blog.naman-dwivedi.in/transition-framework-android

Google Play | Youtube

alt tag

#Usage When launching another activity,specify the views where you want to perform transition and pass it as a bundle. The launching activity and the launched activity should have common views to perform transition on that pair of views.

 Intent intent=new Intent(mContext, DetailActivity.class);
 ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(),   Pair.create((View) cover, "cover"));
 mContext.startActivity(intent,options.toBundle());

Specify the attribute android:transitionName="cover" in both the view of two activities.Transition framework will look for the views with same transitionName attribute and will apply the auto transition on them.

We will specify the transition in our theme. Add this attribute to your v21 theme

<item name="android:windowSharedElementEnterTransition">@transition/shared_element</item>

We will define our own custom Transition instead of the default Transition. #####res/transition/shared_element.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- --A set of transitions on two views performed together <!-- -->
<transitionSet
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:transitionOrdering="together"
    android:duration="240">

    <transitionSet   >
    <!-- --A custom transition defined in PlayTransition class <!-- -->
        <transition
            class="com.naman14.playanimations.PlayTransition"/>
        <targets>
         <!-- --We are excluding the second view from the custom transition <!-- -->
            <target android:excludeId="@id/icon" /> />
        </targets>
        </transitionSet>
<!-- --We have left this one upto transition Framework <!-- -->
    <autoTransition/>

</transitionSet>

PlayTransition.java

License

(c) 2015 Naman Dwivedi

PlayAnimations is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this app. If not, see http://www.gnu.org/licenses/.

playanimations's People

Contributors

naman14 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.