Git Product home page Git Product logo

androidviewanimations's Introduction

Android View Animations Build Status

One day, I saw an iOS library, which is a view shaker, it's very beautiful. I think Android also need one, and should be better.

So, I started to collect animation effects... and in two days, this project born.

Demo

Download Demo

Usage

Since Version 2.0, NineOldAndroids has been removed. Thanks Jake Wharton.

For making animations more real, I created another project named Android Easing Functions which is an implementations of easing functions on Android. So, we need to dependent that project.

Step 1

Gradle

dependencies {
    implementation 'com.daimajia.androidanimations:library:2.4@aar'
}

Maven

<dependency>
    <groupId>com.daimajia.androidanimation</groupId>
    <artifactId>library</artifactId>
    <version>2.4</version>
</dependency>

Step 2

Just like play Yo-yo.

YoYo.with(Techniques.Tada)
    .duration(700)
    .repeat(5)
    .playOn(findViewById(R.id.edit_area));

Effects

Attension

Flash, Pulse, RubberBand, Shake, Swing, Wobble, Bounce, Tada, StandUp, Wave

Special

Hinge, RollIn, RollOut,Landing,TakingOff,DropOut

Bounce

BounceIn, BounceInDown, BounceInLeft, BounceInRight, BounceInUp

Fade

FadeIn, FadeInUp, FadeInDown, FadeInLeft, FadeInRight

FadeOut, FadeOutDown, FadeOutLeft, FadeOutRight, FadeOutUp

Flip

FlipInX, FlipOutX, FlipOutY

Rotate

RotateIn, RotateInDownLeft, RotateInDownRight, RotateInUpLeft, RotateInUpRight

RotateOut, RotateOutDownLeft, RotateOutDownRight, RotateOutUpLeft, RotateOutUpRight

Slide

SlideInLeft, SlideInRight, SlideInUp, SlideInDown

SlideOutLeft, SlideOutRight, SlideOutUp, SlideOutDown

Zoom

ZoomIn, ZoomInDown, ZoomInLeft, ZoomInRight, ZoomInUp

ZoomOut, ZoomOutDown, ZoomOutLeft, ZoomOutRight, ZoomOutUp

Welcome contribute your amazing animation effect. :-D

Thanks

Why YoYo?

YoYo is a toy, with a lot of Techniques.

About me

(2013) A student in mainland China.

Welcome to offer me an internship. If you have any new idea about this project, feel free to contact me.

(2019) Five years later, now I become an investment associate in China.

Welcome to send your business plan to me. Maybe I would have a better understanding on your startup project than others. Trust me.

androidviewanimations's People

Contributors

alexnix avatar bryant1410 avatar callofdutyops avatar chongzhe avatar daimajia avatar dashhunds avatar geminiwen avatar gitter-badger avatar gs053507 avatar imknown avatar krossovochkin avatar mariotaku avatar mthli avatar robertoestivill avatar toteto avatar ubiratansoares avatar uknownothingsnow 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  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

androidviewanimations's Issues

Strange Zoom animations

I raise this issue to clarify what animation ZoomXXXAnimators should describe.
The question raised because of strange behavior.

Example:
Look at ZoomOutUpAnimator.
At first view zooming out and moving down a little and then with a very high velocity view flies up out of screen.
The problem is the last motion (moving out of screen) looks ugly, maybe because of high velocity.

Could you clarify that problem exists, or it's not reproduced for you (tested on ICS 4.0.3 device)?

Animators affected:

  • ZoomOutUpAnimator
  • ZoomOutDownAnimator
  • ZoomInUpAnimator (must see at first motion)
  • ZoomInDownAnimator (must see at first motion)

Also problem not affected with Left/Right Animators. View moves out of screen with high velocity, but not with such, that can make some "artefacts".
PS: there is a problem with ZoomInRight and ZoomOutRight (and ZoomInLeft with ZoomOutLeft) animations maybe have different velocity of moving out of screen (from out of screen). May be this is only visual effect.

The problem may be in '2000' value in animators.
But I would like to know what was expected animation itself to think how it could be fixed.

Thanks

Has conflict with Gson

I have discovered there is a conflict with Gson compile.

Warning:Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
Warning:Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
Warning:Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
Warning:Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages

Interpolators have no effect

I tried a lot of interpolators and None of them have any effect on the animations. I'm doing it this way:

YoYo.with(Techniques.SlideOutDown)
    .duration(200)
    .interpolate(new BounceInterpolator())    // Nothing works here
    .withListener(new Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animation) { }

        @Override
        public void onAnimationEnd(Animator animation) { }

        @Override
        public void onAnimationCancel(Animator animation) { }

        @Override
        public void onAnimationRepeat(Animator animation) { }
    })
    .playOn(view);

I think it might be related to AnimationComposer not calling BaseViewAnimator's setInterpolator().

Wrong jar

AndroidViewAnimations-1.1.2.jar provided here is just the source code,not compiled lib.

Use native Animation with minSDK=14

As now, Android 2.x is about to dead, so we don't need to use NineOldAndroids. Could you please make a new branch use native Animation API instead of based on NineOldAndroids?

Number or time to repeat

Awesome library btw, but I coudlnt' find a way to add a duration in the sense of total length of time playing. If i use the duration with .duration(4000) it just goes super slowly for 4 seconds, I want it to play over and over for a duration or a certain number of repeats

Multiple dex files define

My dependencies is
dependencies {
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.apache.httpcomponents:httpmime:4.2.1'
compile 'com.google.code.gson:gson:2.+'
compile "com.google.android.gms:play-services:3.1.+"
compile 'com.squareup.picasso:picasso:2.2.0'
compile project(':Libraries:date-picker')
compile project(':Libraries:viewpagerindicator')
compile project(':Libraries:pull-torefresh')
compile project(':Libraries:wheel')
compile 'com.google.guava:guava:16.0.1'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.intellij:annotations:5.1'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'commons-codec:commons-codec:1.5'
compile fileTree(dir: 'libs', include: ['.jar', '.aar'])
compile 'com.soundcloud.android:android-crop:0.9.10@aar'
compile 'commons-collections:commons-collections:3.0'
compile 'com.commonsware.cwac:camera:0.6.1'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.0@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
}

libs dir is empty

While build I am getting error

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

FAILED

FAILURE: Build failed with an exception.

Cannot apply correct animation

hi, I am trying to set up an animation on an ImageView by using Techniques.RotateIn

YoYo.with(Techniques.RotateIn)
.duration(1000)
.interpolate(new AccelerateDecelerateInterpolator())
.playOn(mLoginImage);

The result I expect to have is a self-rotation of the ImageView

unfortunately the result now is like using Techniques.RotateInDownLeft

btw, I am using ButterKnife to do the view injection is this related to the issue?

Here is my XML layout

<LinearLayout android:layout_centerInParent="true"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center">

    <ImageView android:id="@+id/login_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/login"/>

    <LinearLayout android:id="@+id/login_panel"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:padding="16dp">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:background="@drawable/bg_bottom_border"
            android:padding="8dp"
            android:hint="username"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:background="@drawable/bg_bottom_border"
            android:padding="8dp"
            android:hint="password"/>

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/selector_button"
            android:textColor="@android:color/white"
            android:text="Login"/>

        </LinearLayout>

</LinearLayout>

Crash on 2.3.6

Hi,
Congrats for the nice job.
Please be aware that you not state the compatibility of the library, actually it crashes on a 2.3.6 device.

This is the LogCat:
09-09 16:11:54.789: E/AndroidRuntime(3606): FATAL EXCEPTION: main
09-09 16:11:54.789: E/AndroidRuntime(3606): java.lang.ClassCastException: android.view.ViewRoot
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.nineoldandroids.view.animation.AnimatorProxy.invalidateAfterUpdate(AnimatorProxy.java:245)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.nineoldandroids.view.animation.AnimatorProxy.setPivotX(AnimatorProxy.java:90)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.nineoldandroids.view.ViewHelper.setPivotX(ViewHelper.java:29)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.daimajia.androidanimations.library.BaseViewAnimator.reset(BaseViewAnimator.java:68)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.daimajia.androidanimations.library.BaseViewAnimator.animate(BaseViewAnimator.java:49)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.daimajia.androidanimations.library.YoYo.play(YoYo.java:146)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.daimajia.androidanimations.library.YoYo.access$800(YoYo.java:36)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.daimajia.androidanimations.library.YoYo$AnimationComposer.playOn(YoYo.java:98)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.example.zzzz.MainActivity$2.run(MainActivity.java:58)
09-09 16:11:54.789: E/AndroidRuntime(3606): at android.os.Handler.handleCallback(Handler.java:587)
09-09 16:11:54.789: E/AndroidRuntime(3606): at android.os.Handler.dispatchMessage(Handler.java:92)
09-09 16:11:54.789: E/AndroidRuntime(3606): at android.os.Looper.loop(Looper.java:130)
09-09 16:11:54.789: E/AndroidRuntime(3606): at android.app.ActivityThread.main(ActivityThread.java:3687)
09-09 16:11:54.789: E/AndroidRuntime(3606): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 16:11:54.789: E/AndroidRuntime(3606): at java.lang.reflect.Method.invoke(Method.java:507)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-09 16:11:54.789: E/AndroidRuntime(3606): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-09 16:11:54.789: E/AndroidRuntime(3606): at dalvik.system.NativeStart.main(Native Method)

Lag when executing animation

I'm having a few performance issues when running a (Techniques.SlideInRight) into a single view. It's not a heavy view to load.

But it is lagging a lot. Is there anything I can try to solve it?
Should I run YoYo inside a handler or a different Thread?

animation flip

i see FlipOutY but wheres FlipInY ?
and thx for this awesome lib!)

Repeat animations

A method should be included on "YoYo" class to allow repeat! That would be very handy =)

Thankyou for great lib!

Animation leaves 'smudge' on screen

When my animation starts, all is fine. It shows my view to me, and then begins the out animation. The out animation, however, leaves the last few frames of the transition as a 'smudge' on my view (as seen in the Circle View)
screenshot_2014-11-23-01-31-46

Download jar from here

Hey buddy, would you mind post .jar versions here on github? i really dont like to use mave. Thanks :)

Exposing AnimatorListener callbacks

I'm thinking about exposing the Animator.AnimatorListener callbacks on the YoYo class.

By doing this, we allow granular handling of animation events

YoYo.with(Techniques.FadeIn)
         .onStart( )
         .onCancel( )
         .onEnd( )
         .onRepeat( )
         .playOn(View)

Each of this methods should take a single method interface. For example:

interface AnimatorCallback {
   public void call( Animator animator); 
}

By doing this, you can subscribe to the event you like, without having to implement the full Animator.AnimatorListener interface yourself.
Internally, YoYo will have to instantiate an Animator.AnimatorListener if any of this methods is called, and the created instance will then call all the added AnimatorCallback's

So we go from this

YoYo.with(Techniques.FadeIn)
         .withListener( new Animator.AnimatorListener {
             @Override
             public void onAnimationStart(Animator animation) {
                 Log.d(TAG, "Animation started"); 
             }
             @Override
             public void onAnimationEnd(Animator animation) {
             }
             @Override
             public void onAnimationCancel(Animator animation) {
             }
             @Override
             public void onAnimationRepeat(Animator animation) {
             }
         })
         .playOn(view)

to this

YoYo.with(Techniques.FadeIn)
         .onStart( new AnimatorCallback() { 
              public void call( Animator anim){
                  Log.d(TAG, "Animation started"); 
             }
          })
         .playOn(view)

Also, by AnimatorCallback being a single method interface, we can eliminate the boilerplate if we use retrolambda (you should!) like the following:

YoYo.with(Techniques.FadeIn)
         .onStart( anim -> Log.d(TAG, "Animation started") )
         .playOn(View)

What do you guys think? I'm willing to work on this and provide a pull request if you think is a good idea.

Thanks
Robert

android:allowBackup should not be used in library

Error:(23, 9) Execution failed for task ':wSRLandlord:processDebugManifest'.

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:23:9
is also present at com.daimajia.easing:library:1.0.0:12:9 value=(true)
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:21:5 to override

there should be an onAnimationEnd Listener

please provide a way to do something at the end of an animation like

Yoyo.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { mListAdapter.removePosition(position); } });

Custom Animations

Greetings,

I have been browsing the code for a few hours, and I couldn't find a way to use the library with custom animations, meaning that we are limited by the animations provided in the Techniques enum.

Is there any way I can extends BaseViewAnimator to provide custom (programmer defined) animations to be used within the library or do I need to roll old fashioned animations manually?

Thanks
Robert

onAnimationStart is called before delay is over

Hi, great library! I experience the following issue: When I create an animation with a delay the onAnimationStart method is called immediately. I think it should be called after the delay when the animation actually starts.

Image after animation lost its scalex value.

I have set android:scaleX="-1" on an imageview. If I animate this imageview, my image loses it's android:scaleX="-1" value. I want to animate my mirrored image. But I can't.

Provide JAR file

Because this library only contains Java code, it can be packed into single JAR instead of library project.

If you can, please give us the JAR file to download.

Thank you.

Can not reset view to original

When I play some rotating animation on a view: YoYo.with(Techniques.RollOut).delay(500).playOn(pig);
then need to clear animations to reset the view: pig.clearAnimation(); The view then stops animating but it's not back to original shape, may be still some transformation applied in!

How can I reset the view?

New animation

Please add to the library move animation.
For example there is an image on the screen and invisible container. The image should move in the container.
Thanks!

WobbleAnimator issue

Rotation in the end of animation should be equal to zero, so instead of:
ObjectAnimator.ofFloat(target, "rotation", 0, -5, 3, -3, 2, -1) // line 39
should be:
ObjectAnimator.ofFloat(target, "rotation", 0, -5, 3, -3, 2, 0)
or
ObjectAnimator.ofFloat(target, "rotation", 0, -5, 3, -3, 2, -1, 0)

PS: sorry for spamming with these small bugs, instead of fixing them and creating pull requests

animation android

Please Help Me How To Create Menu And Layout For Android with Ecilips http://share.pho.to/7Dwcr

i want that when i clicked on the button which is on the top of the page the menu visible like an animation with photo(the icon of the topics)and after clicking on each icon i want it to go to the activity(the page which the topics are shown)

SlideOutUp makes view transparent

So i have this framelayout with to LinearLayout. The first had the effect of Slide OutUp/InDown based on the click of an button on ActionBar. The problem is that when i call the Activity the last line called at the onCreate method is to apply the SlideOutUp on the DropdownMenu. But if i touch the area where this LinearLayout will SlidIn (to be visible) i can active the Spinner that were inside.

So why this is happening?

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:fab="http://schemas.android.com/apk/res-auto"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/DropdownMenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
       (other widgets like spinners ...)

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
      (other widgets ...)

   </LinearLayout>
@Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_layout);
        ButterKnife.inject(this);

        setupListeners();
        toggleSearchBox();
    }

@Override
    public boolean onOptionsItemSelected(MenuItem item) {

        int id = item.getItemId();

        echo.debug("[onOptionsItemSelected] > " + id);

        switch (id) {

            case R.id.action_searchbox:{

                toggleSearchBox();

                break;
            }

            case R.id.action_reload:{

                this.refreshHistoricosEmAberto();

                break;

            }

        }

        return super.onOptionsItemSelected(item);
    }

public       int llSearchFilterBoxStatus = 1;
public void toggleSearchBox(){
        if (llSearchFilterBoxStatus == 0) {
            llSearchFilterBoxStatus = 1;
            YoYo.with(Techniques.SlideInDown).duration(350).playOn(llSearchFilterBox);

        } else {
            llSearchFilterBoxStatus = 0;
            YoYo.with(Techniques.SlideOutUp).duration(350).playOn(llSearchFilterBox);
        }
    }

launcher icon?

Hello,
First i wanted to say thanks for the library, it is truly useful. I do have 1 question though. After adding this library to my project my app icon reverts back to the stock android icon. My icon is named ic_launcher2, and the manifest merger forces me to change it to ic_launcher. After that my icon no longer shows up, and the android one does. Any ideas why and how to fix it? I'm using Android studio btw.

Thanks
Karsten.

view or viewgroup instead of the View.getTag.

Hi. thank you for your build animation library, I met some problems in use process.I want to use this animation in a view.Such as:
((BaseViewAnimator) (view.getTag())).setDuration(800)
.setInterpolator(new AccelerateInterpolator())
.animate(mTarget);
How to make the view or viewgroup instead of the View.getTag.

Thanks a lots;

Hide before animation

This might be a stupid question but how do I hide the target view before the animation? For example if I am using the Techniques.ZoomInUp animation I want the view to be hidden before the animation is applied; by default the image is displayed for a split second then hidden when the .playon() gets called (and then of course zooms back into view).

Thanks.

How to set the center point of animations?

Hi.
This is a very nice library to use animation in android.
But why it is different effect in my project ?such as DropOutAnimation.
I import it by gradle.
Can you help me to use if you have time ?
Thanks

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.