Convert Figma logo to code with AI

daimajia logoAndroidViewAnimations

Cute view animation collection.

12,422
2,422
12,422
64

Top Related Projects

A curated list of awesome Android UI/UX libraries

Render After Effects animations natively on Android and iOS, Web, and React Native

A fluent Android animation library

5,436

A Java library that models spring dynamics and adds real world physics to your app.

Android Transition animations explanation with examples.

Quick Overview

AndroidViewAnimations is a popular Android library that provides a collection of pre-built animations for UI elements. It simplifies the process of adding engaging and smooth animations to Android applications, enhancing the overall user experience with minimal effort from developers.

Pros

  • Easy to use with a simple and intuitive API
  • Wide variety of pre-built animations available
  • Supports chaining multiple animations for complex effects
  • Lightweight and efficient, with minimal impact on app performance

Cons

  • Limited customization options for advanced animation requirements
  • Some animations may not be suitable for all UI designs
  • Lack of recent updates or maintenance (last updated in 2017)
  • May not fully support the latest Android versions or Material Design guidelines

Code Examples

  1. Basic usage to apply a bounce animation to a view:
YoYo.with(Techniques.Bounce)
    .duration(700)
    .repeat(2)
    .playOn(findViewById(R.id.textView));
  1. Chaining multiple animations:
YoYo.with(Techniques.Bounce)
    .duration(1000)
    .withListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationEnd(Animator animation) {
            YoYo.with(Techniques.FadeOut)
                .duration(500)
                .playOn(findViewById(R.id.textView));
        }
        // Implement other listener methods
    })
    .playOn(findViewById(R.id.textView));
  1. Using a custom animation:
YoYo.with(new BaseViewAnimator() {
    @Override
    protected void prepare(View target) {
        getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0),
            ObjectAnimator.ofFloat(target, "translationY", 0, -25, 25, -25, 25, -15, 15, -6, 6, 0)
        );
    }
})
.duration(1000)
.playOn(findViewById(R.id.textView));

Getting Started

  1. Add the dependency to your build.gradle file:
dependencies {
    implementation 'com.daimajia.androidanimations:library:2.3@aar'
}
  1. Apply an animation in your Activity or Fragment:
import com.daimajia.androidanimations.library.YoYo;

// In your onCreate() or other appropriate method
YoYo.with(Techniques.FadeIn)
    .duration(1000)
    .playOn(findViewById(R.id.yourView));

Competitor Comparisons

A curated list of awesome Android UI/UX libraries

Pros of awesome-android-ui

  • Comprehensive collection of UI libraries and components
  • Regularly updated with new and trending UI resources
  • Categorized for easy navigation and discovery

Cons of awesome-android-ui

  • Not a standalone library, requires integration of multiple dependencies
  • May lead to inconsistency in UI design if using various libraries

Code comparison

AndroidViewAnimations:

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

awesome-android-ui (using a library from the collection, e.g., Material-Animations):

TransitionManager.beginDelayedTransition(container);
view.setVisibility(visible ? View.VISIBLE : View.GONE);

Summary

AndroidViewAnimations is a focused library for view animations, while awesome-android-ui is a curated list of various UI libraries and components. AndroidViewAnimations provides a simple API for applying pre-defined animations, whereas awesome-android-ui offers a wide range of UI resources that developers can choose from based on their specific needs.

The choice between these repositories depends on the project requirements. If you need a quick and easy way to add animations to your views, AndroidViewAnimations might be more suitable. However, if you're looking for a comprehensive collection of UI resources and are willing to integrate multiple libraries, awesome-android-ui provides a broader selection of options for enhancing your Android app's user interface.

Render After Effects animations natively on Android and iOS, Web, and React Native

Pros of Lottie-Android

  • Supports complex, high-quality animations created in Adobe After Effects
  • Renders animations natively on device, reducing file size and improving performance
  • Extensive customization options, including dynamic property manipulation

Cons of Lottie-Android

  • Steeper learning curve, especially for designers unfamiliar with After Effects
  • Requires additional tools and workflow (Adobe After Effects, Bodymovin plugin)
  • Potentially higher initial development time for complex animations

Code Comparison

AndroidViewAnimations:

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

Lottie-Android:

LottieAnimationView animationView = findViewById(R.id.animation_view);
animationView.setAnimation(R.raw.button_animation);
animationView.playAnimation();

Summary

AndroidViewAnimations offers simple, pre-defined animations with minimal setup, making it ideal for quick implementations. Lottie-Android provides more complex, customizable animations but requires additional tools and expertise. Choose based on your project's animation requirements and development resources.

A fluent Android animation library

Pros of ViewAnimator

  • More flexible and customizable animation chaining
  • Supports both View and ViewProperty animations
  • Easier to create complex animation sequences

Cons of ViewAnimator

  • Slightly more verbose syntax for simple animations
  • Less extensive pre-built animation library

Code Comparison

ViewAnimator:

ViewAnimator
    .animate(view)
    .scale(0, 1)
    .alpha(0, 1)
    .onStart { }
    .onStop { }
    .start()

AndroidViewAnimations:

YoYo.with(Techniques.FadeIn)
    .duration(700)
    .playOn(view);

Key Differences

  • ViewAnimator offers a more fluent API for chaining animations
  • AndroidViewAnimations provides a larger set of pre-defined animations
  • ViewAnimator supports both View and ViewProperty animations, while AndroidViewAnimations focuses on View animations

Use Cases

  • ViewAnimator: Complex, custom animation sequences
  • AndroidViewAnimations: Quick implementation of common animations

Community and Maintenance

  • Both projects are well-maintained and have active communities
  • AndroidViewAnimations has a larger user base and more stars on GitHub
  • ViewAnimator has more recent updates and active development

Integration

Both libraries are easy to integrate into Android projects, with similar setup processes through Gradle dependencies.

5,436

A Java library that models spring dynamics and adds real world physics to your app.

Pros of Rebound

  • More flexible and customizable spring animations
  • Can be used for non-UI animations and physics simulations
  • Supports both Android and iOS platforms

Cons of Rebound

  • Steeper learning curve due to its lower-level API
  • Requires more code to implement simple animations
  • Less out-of-the-box animations compared to AndroidViewAnimations

Code Comparison

AndroidViewAnimations:

YoYo.with(Techniques.Bounce)
    .duration(700)
    .repeat(5)
    .playOn(findViewById(R.id.animation_target));

Rebound:

Spring spring = springSystem.createSpring();
spring.addListener(new SimpleSpringListener() {
    @Override
    public void onSpringUpdate(Spring spring) {
        float value = (float) spring.getCurrentValue();
        animationTarget.setScaleX(value);
        animationTarget.setScaleY(value);
    }
});
spring.setEndValue(1);

AndroidViewAnimations offers a more concise and straightforward approach for common animations, while Rebound provides greater control and flexibility at the cost of more verbose code. AndroidViewAnimations is better suited for quick, pre-defined animations, whereas Rebound excels in creating custom, physics-based animations across multiple platforms.

Android Transition animations explanation with examples.

Pros of Material-Animations

  • Focuses on Material Design animations and transitions
  • Provides more complex, scene-based animations
  • Includes detailed examples and explanations for each animation type

Cons of Material-Animations

  • Limited to Material Design-specific animations
  • Requires more setup and configuration for each animation
  • Less suitable for simple, quick animations on individual views

Code Comparison

Material-Animations:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transition);
    setupWindowAnimations();
}

AndroidViewAnimations:

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

Material-Animations focuses on scene transitions and complex animations, requiring more setup but offering powerful Material Design-specific effects. AndroidViewAnimations provides a simpler API for quick, individual view animations with a wide variety of pre-defined effects.

Material-Animations is better suited for apps strictly following Material Design guidelines and requiring intricate transitions between screens or components. AndroidViewAnimations is more versatile for adding simple, eye-catching animations to individual views across various app styles.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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.