Convert Figma logo to code with AI

MasayukiSuda logoEasingInterpolator

Thirty-one different easing animation interpolators for Android.

1,099
133
1,099
0

Top Related Projects

5,436

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

Cute view animation collection.

[DEPRECATED] Android library for using the Honeycomb animation API on all versions of the platform back to 1.0!

An Android Animation library which easily add itemanimator to RecyclerView items.

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

Quick Overview

EasingInterpolator is an Android library that provides a collection of easing functions for animations. It offers various interpolation methods to create smooth and natural-looking animations in Android applications, enhancing the user experience with more visually appealing transitions.

Pros

  • Wide variety of easing functions, including bounce, elastic, and custom cubic bezier interpolations
  • Easy integration with Android's existing animation framework
  • Lightweight library with minimal impact on app size
  • Well-documented and easy to use

Cons

  • Limited to Android platform, not available for other mobile or web development
  • May require additional performance considerations for complex animations on low-end devices
  • Some advanced easing functions might be overkill for simple animations

Code Examples

  1. Creating a simple animation with EasingInterpolator:
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", 0f, 100f);
animator.setDuration(1000);
animator.setInterpolator(new EasingInterpolator(Ease.CUBIC_OUT));
animator.start();
  1. Using a custom cubic bezier interpolation:
CubicBezierInterpolator customInterpolator = new CubicBezierInterpolator(.17,.67,.83,.67);
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f);
animator.setInterpolator(customInterpolator);
animator.start();
  1. Applying easing to ViewPropertyAnimator:
view.animate()
    .translationY(100f)
    .setDuration(1000)
    .setInterpolator(new EasingInterpolator(Ease.BOUNCE_OUT))
    .start();

Getting Started

  1. Add the dependency to your app's build.gradle file:
dependencies {
    implementation 'com.daasuu:EasingInterpolator:1.3.0'
}
  1. Use the EasingInterpolator in your animations:
import com.daasuu.ei.EasingInterpolator;
import com.daasuu.ei.Ease;

// In your animation code
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
animator.setDuration(1000);
animator.setInterpolator(new EasingInterpolator(Ease.ELASTIC_IN_OUT));
animator.start();

Competitor Comparisons

5,436

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

Pros of rebound

  • More comprehensive physics-based animation system
  • Supports complex spring animations and chained animations
  • Provides a visual UI for designing and testing animations

Cons of rebound

  • Steeper learning curve due to its more complex API
  • Potentially overkill for simple easing animations
  • Larger library size compared to EasingInterpolator

Code Comparison

EasingInterpolator:

EasingInterpolator interpolator = new EasingInterpolator(Ease.CUBIC_OUT);
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 100);
animator.setInterpolator(interpolator);
animator.start();

rebound:

Spring spring = springSystem.createSpring();
spring.addListener(new SimpleSpringListener() {
    @Override
    public void onSpringUpdate(Spring spring) {
        float value = (float) spring.getCurrentValue();
        view.setTranslationY(value);
    }
});
spring.setEndValue(100);

EasingInterpolator is simpler to use for basic easing animations, while rebound offers more control and flexibility for complex, physics-based animations. EasingInterpolator is lightweight and easy to integrate, whereas rebound provides a more robust animation system with additional features and customization options.

Cute view animation collection.

Pros of AndroidViewAnimations

  • Offers a wide range of pre-built animations for Android views
  • Provides a simple and intuitive API for applying animations
  • Includes support for custom animations and easing functions

Cons of AndroidViewAnimations

  • Larger library size compared to EasingInterpolator
  • May include unnecessary animations for projects with specific needs
  • Less focused on easing functions, which are the core of EasingInterpolator

Code Comparison

EasingInterpolator:

EasingInterpolator interpolator = new EasingInterpolator(Ease.CUBIC_IN);
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 100);
animator.setInterpolator(interpolator);
animator.start();

AndroidViewAnimations:

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

EasingInterpolator focuses on providing various easing functions for use with Android's animation system, while AndroidViewAnimations offers a higher-level API with pre-built animations. EasingInterpolator gives more control over the interpolation, while AndroidViewAnimations simplifies the process of applying common animations to views.

[DEPRECATED] Android library for using the Honeycomb animation API on all versions of the platform back to 1.0!

Pros of NineOldAndroids

  • Broader compatibility, supporting Android 1.0 and up
  • More comprehensive animation library with a wider range of features
  • Well-established and widely adopted in the Android development community

Cons of NineOldAndroids

  • No longer actively maintained (last update in 2014)
  • Larger library size compared to EasingInterpolator
  • May include unnecessary features for projects only needing easing functions

Code Comparison

EasingInterpolator:

EasingInterpolator interpolator = new EasingInterpolator(Ease.CUBIC_IN);
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 100);
animator.setInterpolator(interpolator);
animator.start();

NineOldAndroids:

ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 100);
animator.setInterpolator(new AccelerateInterpolator());
animator.start();

Summary

EasingInterpolator is a lightweight library focused specifically on easing functions, while NineOldAndroids is a more comprehensive animation library with broader compatibility. EasingInterpolator is actively maintained and offers a wide range of easing options, making it a good choice for projects that only need easing functionality. NineOldAndroids, while no longer maintained, provides a complete animation solution for older Android versions but may be overkill for simpler animation needs.

An Android Animation library which easily add itemanimator to RecyclerView items.

Pros of recyclerview-animators

  • Specifically designed for RecyclerView animations, offering a wide range of pre-built animations
  • Provides easy-to-use methods for adding, removing, and changing items with animations
  • Supports custom animations and interpolators for more flexibility

Cons of recyclerview-animators

  • Limited to RecyclerView animations, while EasingInterpolator can be used with any Android animation
  • May have a slightly larger footprint due to its more comprehensive feature set
  • Requires more setup and configuration compared to the simpler EasingInterpolator

Code Comparison

EasingInterpolator:

ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 100);
animator.setInterpolator(new EasingInterpolator(Ease.CUBIC_OUT));
animator.start();

recyclerview-animators:

RecyclerView.ItemAnimator animator = new SlideInLeftAnimator();
animator.setAddDuration(300);
recyclerView.setItemAnimator(animator);

Both libraries offer ways to enhance Android animations, but they serve different purposes. EasingInterpolator focuses on providing various easing functions for general animations, while recyclerview-animators specializes in RecyclerView-specific animations with a broader range of pre-built options and more complex functionality.

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

Pros of Lottie

  • Supports complex animations created in Adobe After Effects
  • Extensive ecosystem with tools and plugins for designers and developers
  • Offers cross-platform support (Android, iOS, Web, React Native)

Cons of Lottie

  • Larger library size and potential performance overhead for simple animations
  • Steeper learning curve, especially for designers unfamiliar with After Effects

Code Comparison

EasingInterpolator:

EasingInterpolator interpolator = new EasingInterpolator(Ease.CUBIC_IN);
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", 0, 100);
animator.setInterpolator(interpolator);
animator.start();

Lottie:

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

Summary

EasingInterpolator is a lightweight library focused on easing functions for Android animations. It's simple to use and ideal for basic interpolation needs. Lottie, on the other hand, is a comprehensive animation solution that enables designers to create complex animations in After Effects and easily implement them in apps. While Lottie offers more power and flexibility, it comes with a larger footprint and potentially steeper learning curve. The choice between the two depends on the complexity of animations required and the desired workflow between designers and developers.

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

EasingInterpolator

Platform API Android Arsenal

Thirty-one different easing animation interpolators for Android.
It does not use the standard 4 param ease signature. Instead it uses a single param which indicates the current linear ratio (0 to 1) of the tween.

Gradle

Step 1. Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

    dependencies {
        implementation 'com.github.MasayukiSuda:EasingInterpolator:v1.3.2'
    }

Usage


    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.setInterpolator(new EasingInterpolator(Ease.CUBIC_IN));
    valueAnimator.start();

    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, 300);
    animator.setInterpolator(new EasingInterpolator(Ease.ELASTIC_IN_OUT)));
    animator.start();

Easing Graphs

ProGuard

-keep class com.daasuu.** { *; }

License

Copyright 2015 MasayukiSuda

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.