├── .gitignore ├── .travis.yml ├── License ├── README.md ├── build.gradle ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── daimajia │ │ └── androidanimations │ │ ├── EffectAdapter.java │ │ ├── ExampleActivity.java │ │ └── MyActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_my.xml │ ├── example.xml │ └── item.xml │ ├── menu │ └── my.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── gradle-mvn-push.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── daimajia │ └── androidanimations │ └── library │ ├── BaseViewAnimator.java │ ├── Techniques.java │ ├── YoYo.java │ ├── attention │ ├── BounceAnimator.java │ ├── FlashAnimator.java │ ├── PulseAnimator.java │ ├── RubberBandAnimator.java │ ├── ShakeAnimator.java │ ├── StandUpAnimator.java │ ├── SwingAnimator.java │ ├── TadaAnimator.java │ ├── WaveAnimator.java │ └── WobbleAnimator.java │ ├── bouncing_entrances │ ├── BounceInAnimator.java │ ├── BounceInDownAnimator.java │ ├── BounceInLeftAnimator.java │ ├── BounceInRightAnimator.java │ └── BounceInUpAnimator.java │ ├── fading_entrances │ ├── FadeInAnimator.java │ ├── FadeInDownAnimator.java │ ├── FadeInLeftAnimator.java │ ├── FadeInRightAnimator.java │ └── FadeInUpAnimator.java │ ├── fading_exits │ ├── FadeOutAnimator.java │ ├── FadeOutDownAnimator.java │ ├── FadeOutLeftAnimator.java │ ├── FadeOutRightAnimator.java │ └── FadeOutUpAnimator.java │ ├── flippers │ ├── FlipInXAnimator.java │ ├── FlipOutXAnimator.java │ ├── FlipOutYAnimator.java │ └── FlipYAnimator.java │ ├── rotating_entrances │ ├── RotateInAnimator.java │ ├── RotateInDownLeftAnimator.java │ ├── RotateInDownRightAnimator.java │ ├── RotateInUpLeftAnimator.java │ └── RotateInUpRightAnimator.java │ ├── rotating_exits │ ├── RotateOutAnimator.java │ ├── RotateOutDownLeftAnimator.java │ ├── RotateOutDownRightAnimator.java │ ├── RotateOutUpLeftAnimator.java │ └── RotateOutUpRightAnimator.java │ ├── sliders │ ├── SlideInDownAnimator.java │ ├── SlideInLeftAnimator.java │ ├── SlideInRightAnimator.java │ ├── SlideInUpAnimator.java │ ├── SlideOutDownAnimator.java │ ├── SlideOutLeftAnimator.java │ ├── SlideOutRightAnimator.java │ └── SlideOutUpAnimator.java │ ├── specials │ ├── HingeAnimator.java │ ├── RollInAnimator.java │ └── RollOutAnimator.java │ ├── zooming_entrances │ ├── ZoomInAnimator.java │ ├── ZoomInDownAnimator.java │ ├── ZoomInLeftAnimator.java │ ├── ZoomInRightAnimator.java │ └── ZoomInUpAnimator.java │ └── zooming_exits │ ├── ZoomOutAnimator.java │ ├── ZoomOutDownAnimator.java │ ├── ZoomOutLeftAnimator.java │ ├── ZoomOutRightAnimator.java │ └── ZoomOutUpAnimator.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | .DS_Store 5 | /build 6 | # built application files 7 | *.apk 8 | *.ap_ 9 | 10 | # files for the dex VM 11 | *.dex 12 | 13 | # Java class files 14 | *.class 15 | .DS_Store 16 | 17 | # generated files 18 | bin/ 19 | gen/ 20 | Wiki/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Eclipse project files 26 | .classpath 27 | .project 28 | .settings/ 29 | 30 | # Proguard folder generated by Eclipse 31 | proguard/ 32 | 33 | #Android Studio 34 | build/ 35 | 36 | # Intellij project files 37 | *.iml 38 | *.ipr 39 | *.iws 40 | .idea/ 41 | 42 | #gradle 43 | .gradle/ 44 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk7 3 | env: 4 | matrix: 5 | - ANDROID_TARGET=android-20 ANDROID_ABI=armeabi-v7a 6 | 7 | before_install: 8 | # Install base Android SDK 9 | - sudo apt-get update -qq 10 | - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi 11 | - wget http://dl.google.com/android/android-sdk_r23-linux.tgz 12 | - tar xzf android-sdk_r23-linux.tgz 13 | - export ANDROID_HOME=$PWD/android-sdk-linux 14 | - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools 15 | 16 | # Gradle 17 | - wget http://services.gradle.org/distributions/gradle-1.12-bin.zip 18 | - unzip gradle-1.12-bin.zip 19 | - export GRADLE_HOME=$PWD/gradle-1.12 20 | - export PATH=$GRADLE_HOME/bin:$PATH 21 | 22 | # Install required components 23 | # For a full list, run `android list sdk -a --extended` 24 | # Note that sysimg-19 downloads only ARM, because only the first license query is accepted. 25 | - echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null 26 | - echo yes | android update sdk --all --filter build-tools-20.0.0 --no-ui --force > /dev/null 27 | - echo yes | android update sdk --filter android-20 --no-ui --force > /dev/null 28 | - echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null 29 | - echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null 30 | - echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null 31 | 32 | install: 33 | - ./gradlew assemble -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 daimajia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android View Animations [![Build Status](https://travis-ci.org/daimajia/AndroidViewAnimations.svg)](https://travis-ci.org/daimajia/AndroidAnimations) 2 | 3 | One day, I saw [an iOS library](https://github.com/ArtFeel/AFViewShaker), which is a view shaker, it's very beautiful. I think Android also need one, and should be better. 4 | 5 | So, I started to collect animation effects... and in two days, this project born. 6 | 7 | # Demo 8 | 9 | ![](http://ww3.sinaimg.cn/mw690/610dc034jw1ehnv2r93jpg20bx0kokjl.gif) 10 | 11 | [Download Demo](https://github.com/daimajia/AndroidViewAnimations/releases/download/v1.0.5/demo-v1.0.5.apk) 12 | # Usage 13 | 14 | For making animations more real, I created another project named [Android Easing Functions](https://github.com/daimajia/AnimationEasingFunctions) which is an implementations of [easing functions](http://easings.net/) on Android. So, we need to dependent that project. 15 | 16 | ## Step 1 17 | 18 | ```groovy 19 | dependencies { 20 | compile 'com.nineoldandroids:library:2.4.0' 21 | compile 'com.daimajia.easing:library:1.0.0@aar' 22 | compile 'com.daimajia.androidanimations:library:1.0.6@aar' 23 | } 24 | ``` 25 | or Maven 26 | 27 | ```xml 28 | 29 | com.nineoldandroids 30 | library 31 | 2.4.0 32 | 33 | 34 | com.daimajia.androidanimation 35 | library 36 | 1.0.6 37 | apklib 38 | 39 | 40 | com.daimajia.easing 41 | library 42 | 1.0.0 43 | apklib 44 | 45 | ``` 46 | 47 | ## Step 2 48 | 49 | Just like play Yo-yo. 50 | 51 | ```java 52 | YoYo.with(Techniques.Tada) 53 | .duration(700) 54 | .playOn(findViewById(R.id.edit_area)); 55 | ``` 56 | 57 | ### Effects 58 | #### Attension 59 | `Flash`, `Pulse`, `RubberBand`, `Shake`, `Swing`, `Wobble`, `Bounce`, `Tada`, `StandUp`, `Wave` 60 | 61 | #### Special 62 | `Hinge`, `RollIn`, `RollOut` 63 | 64 | #### Bounce 65 | `BounceIn`, `BounceInDown`, `BounceInLeft`, `BounceInRight`, `BounceInUp` 66 | 67 | #### Fade 68 | `FadeIn`, `FadeInUp`, `FadeInDown`, `FadeInLeft`, `FadeInRight` 69 | 70 | `FadeOut`, `FadeOutDown`, `FadeOutLeft`, `FadeOutRight`, `FadeOutUp` 71 | 72 | #### Flip 73 | `FlipInX`, `FlipOutX`, `FlipOutY` 74 | 75 | #### Rotate 76 | `RotateIn`, `RotateInDownLeft`, `RotateInDownRight`, `RotateInUpLeft`, `RotateInUpRight` 77 | 78 | `RotateOut`, `RotateOutDownLeft`, `RotateOutDownRight`, `RotateOutUpLeft`, `RotateOutUpRight` 79 | 80 | #### Slide 81 | `SlideInLeft`, `SlideInRight`, `SlideInUp`, `SlideInDown` 82 | 83 | `SlideOutLeft`, `SlideOutRight`, `SlideOutUp`, `SlideOutDown` 84 | 85 | #### Zoom 86 | `ZoomIn`, `ZoomInDown`, `ZoomInLeft`, `ZoomInRight`, `ZoomInUp` 87 | 88 | `ZoomOut`, `ZoomOutDown`, `ZoomOutLeft`, `ZoomOutRight`, `ZoomOutUp` 89 | 90 | Welcome contribute your amazing animation effect. :-D 91 | 92 | #Thanks 93 | 94 | - [AFViewShaker](https://github.com/ArtFeel/AFViewShaker) 95 | - [Animate.css](https://github.com/daneden/animate.css) 96 | 97 | #About me 98 | 99 | A student in mainland China. 100 | 101 | Welcome to [offer me an internship](mailto:daimajia@gmail.com). 102 | If you have any new idea about this project, feel free to [contact me](mailto:daimajia@gmail.com). 103 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:0.12.+' 9 | classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+' 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenCentral() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android-sdk-manager' 2 | apply plugin: 'android' 3 | 4 | android { 5 | compileSdkVersion 20 6 | buildToolsVersion "20" 7 | 8 | defaultConfig { 9 | applicationId "com.daimajia.androidanimations" 10 | minSdkVersion 8 11 | targetSdkVersion 20 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | runProguard false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | lintOptions{ 22 | abortOnError false 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | compile 'com.nineoldandroids:library:2.4.0' 29 | compile project(':library') 30 | } 31 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /demo/src/main/java/com/daimajia/androidanimations/EffectAdapter.java: -------------------------------------------------------------------------------- 1 | package com.daimajia.androidanimations; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.TextView; 9 | 10 | import com.daimajia.androidanimations.library.Techniques; 11 | 12 | public class EffectAdapter extends BaseAdapter { 13 | 14 | private Context mContext; 15 | 16 | public EffectAdapter(Context context){ 17 | mContext = context; 18 | } 19 | 20 | @Override 21 | public int getCount() { 22 | return Techniques.values().length; 23 | } 24 | 25 | @Override 26 | public Object getItem(int position) { 27 | return Techniques.values()[position].getAnimator(); 28 | } 29 | 30 | @Override 31 | public long getItemId(int position) { 32 | return position; 33 | } 34 | 35 | @Override 36 | public View getView(final int position, View convertView, ViewGroup parent) { 37 | View v = LayoutInflater.from(mContext).inflate(R.layout.item,null,false); 38 | TextView t = (TextView)v.findViewById(R.id.list_item_text); 39 | Object o = getItem(position); 40 | int start = o.getClass().getName().lastIndexOf(".") + 1; 41 | String name = o.getClass().getName().substring(start); 42 | t.setText(name); 43 | v.setTag(o); 44 | return v; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/src/main/java/com/daimajia/androidanimations/ExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.daimajia.androidanimations; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.daimajia.androidanimations.library.Techniques; 9 | import com.daimajia.androidanimations.library.YoYo; 10 | 11 | public class ExampleActivity extends Activity { 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.example); 16 | 17 | final TextView t = (TextView) findViewById(R.id.notice); 18 | t.setText("Please input your Email and Password"); 19 | 20 | findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() { 21 | @Override 22 | public void onClick(View v) { 23 | 24 | YoYo.with(Techniques.Tada) 25 | .duration(700) 26 | .playOn(findViewById(R.id.edit_area)); 27 | 28 | t.setText("Wrong password!"); 29 | } 30 | }); 31 | 32 | final TextView t2 = (TextView) findViewById(R.id.notice2); 33 | t2.setText("Please input your Email and Password"); 34 | 35 | findViewById(R.id.submit2).setOnClickListener(new View.OnClickListener() { 36 | @Override 37 | public void onClick(View v) { 38 | 39 | YoYo.with(Techniques.Shake).playOn(findViewById(R.id.edit_area2)); 40 | 41 | t2.setText("Wrong password!"); 42 | } 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demo/src/main/java/com/daimajia/androidanimations/MyActivity.java: -------------------------------------------------------------------------------- 1 | package com.daimajia.androidanimations; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.view.animation.AccelerateInterpolator; 10 | import android.widget.AdapterView; 11 | import android.widget.ListView; 12 | 13 | import com.daimajia.androidanimations.library.BaseViewAnimator; 14 | 15 | public class MyActivity extends Activity { 16 | 17 | private ListView mListView; 18 | private EffectAdapter mAdapter; 19 | private View mTarget; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_my); 25 | mListView = (ListView)findViewById(R.id.list_items); 26 | mTarget = findViewById(R.id.hello_world); 27 | mAdapter = new EffectAdapter(this); 28 | mListView.setAdapter(mAdapter); 29 | mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 30 | @Override 31 | public void onItemClick(AdapterView parent, View view, int position, long id) { 32 | ((BaseViewAnimator) (view.getTag())).setDuration(800) 33 | .setInterpolator(new AccelerateInterpolator()) 34 | .animate(mTarget); 35 | } 36 | }); 37 | } 38 | 39 | 40 | @Override 41 | public boolean onCreateOptionsMenu(Menu menu) { 42 | // Inflate the menu; this adds items to the action bar if it is present. 43 | getMenuInflater().inflate(R.menu.my, menu); 44 | return true; 45 | } 46 | 47 | @Override 48 | public boolean onOptionsItemSelected(MenuItem item) { 49 | // Handle action bar item clicks here. The action bar will 50 | // automatically handle clicks on the Home/Up button, so long 51 | // as you specify a parent activity in AndroidManifest.xml. 52 | int id = item.getItemId(); 53 | if (id == R.id.action_settings) { 54 | startActivity(new Intent(this,ExampleActivity.class)); 55 | return true; 56 | } 57 | return super.onOptionsItemSelected(item); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etao-open-source/AndroidViewAnimations/52dddde4795d9d81247397d8181c3d63e8a5d696/demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etao-open-source/AndroidViewAnimations/52dddde4795d9d81247397d8181c3d63e8a5d696/demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etao-open-source/AndroidViewAnimations/52dddde4795d9d81247397d8181c3d63e8a5d696/demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etao-open-source/AndroidViewAnimations/52dddde4795d9d81247397d8181c3d63e8a5d696/demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_my.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 14 | 18 | 22 | 23 | 24 | 29 | 33 |