kandi background
Explore Kits

lottie-android | Effects animations natively on Android iOS Web | Animation library

 by   airbnb Java Version: v5.0.3 License: Apache-2.0

 by   airbnb Java Version: v5.0.3 License: Apache-2.0

Download this library from

kandi X-RAY | lottie-android Summary

lottie-android is a Java library typically used in Telecommunications, Media, Telecom, User Interface, Animation, React Native, React applications. lottie-android has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.
Render After Effects animations natively on Android and iOS, Web, and React Native
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • lottie-android has a highly active ecosystem.
  • It has 32616 star(s) with 5243 fork(s). There are 853 watchers for this library.
  • There were 3 major release(s) in the last 12 months.
  • There are 20 open issues and 1392 have been closed. On average issues are closed in 95 days. There are 3 open pull requests and 0 closed requests.
  • It has a positive sentiment in the developer community.
  • The latest version of lottie-android is v5.0.3
lottie-android Support
Best in #Animation
Average in #Animation
lottie-android Support
Best in #Animation
Average in #Animation

quality kandi Quality

  • lottie-android has 0 bugs and 0 code smells.
lottie-android Quality
Best in #Animation
Average in #Animation
lottie-android Quality
Best in #Animation
Average in #Animation

securitySecurity

  • lottie-android has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • lottie-android code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
lottie-android Security
Best in #Animation
Average in #Animation
lottie-android Security
Best in #Animation
Average in #Animation

license License

  • lottie-android is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
lottie-android License
Best in #Animation
Average in #Animation
lottie-android License
Best in #Animation
Average in #Animation

buildReuse

  • lottie-android releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • lottie-android saves you 12769 person hours of effort in developing the same functionality from scratch.
  • It has 32615 lines of code, 2114 functions and 568 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
lottie-android Reuse
Best in #Animation
Average in #Animation
lottie-android Reuse
Best in #Animation
Average in #Animation
Top functions reviewed by kandi - BETA

kandi has reviewed lottie-android and discovered the below as its top functions. This is intended to give you an instant insight into lottie-android implemented functionality, and help decide if they suit your requirements.

  • Parses a multi - dimensional keyframe .
    • Peek the next token .
      • Create the arrow path .
        • Draws the trace matrix .
          • Returns a copy of the ShapeData object with a rounded corner .
            • Initializes the LottieAnimationView
              • Apply the trim path .
                • Returns the current rotation matrix .
                  • Renders the canvas into a bitmap .
                    • Returns the nearest node for the given key .

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      lottie-android Key Features

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

                      Download

                      copy iconCopydownload iconDownload
                      dependencies {
                        implementation 'com.airbnb.android:lottie:$lottieVersion'
                      }
                      

                      How to know when lottie animation is completed?

                      copy iconCopydownload iconDownload
                      mAddedToCartAnimation.addAnimatorListener(new Animator.AnimatorListener() {
                              @Override
                              public void onAnimationStart(Animator animation) {
                                  Log.e("Animation:","start");
                              }
                      
                              @Override
                              public void onAnimationEnd(Animator animation) {
                                  Log.e("Animation:","end");
                                  //Your code for remove the fragment
                                  try {
                                      getActivity().getSupportFragmentManager()
                                            .beginTransaction().remove(this).commit();
                                  } catch(Exception ex) {
                                      ex.toString();
                                  }
                              }
                      
                              @Override
                              public void onAnimationCancel(Animator animation) {
                                  Log.e("Animation:","cancel");
                              }
                      
                              @Override
                              public void onAnimationRepeat(Animator animation) {
                                  Log.e("Animation:","repeat");
                              }
                          });
                      
                       <RelativeLayout
                         android:id="@+id/contanierForAnimationId"
                         android:layout_width="50dp"
                         android:layout_height="50dp"
                         android:visibility="visible">
                            <com.airbnb.lottie.LottieAnimationView
                                android:id="@+id/aLottieAnimationId"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                app:lottie_autoPlay="false"
                                app:lottie_fileName="animation.json"
                                app:lottie_repeatCount="0" />
                      </RelativeLayout>
                      
                      var aLottieAnimationId : LottieAnimationView? = null
                      var contanierForAnimationId: RelativeLayout? = null
                      
                      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 
                      savedInstanceState: Bundle?): View? {
                      
                          val view = inflater.inflate( R.layout.my_Layout, container, false )
                          aLottieAnimationId = view.findViewById(R.id.aLottieAnimationId) as LottieAnimationView
                      contanierForAnimationId = view.findViewById(R.id.contanierForAnimationId) as RelativeLayout
                      
                      
                          aLottieAnimationId?.setOnClickListener {
                            aLottieAnimationId?.setOnClickListener(null)
                            aLottieAnimationId?.speed = 1f
                            aLottieAnimationId?.playAnimation()
                            aLottieAnimationId?.setMinAndMaxFrame(0, 90) //How many frames does the animation have
                             aLottieAnimationId?.addAnimatorUpdateListener { valueAnimator ->
                               // Set animation progress
                                 val progress = (valueAnimator.animatedValue as Float * 100).toInt()
                                 Log.d("progress :","$progress")
                               //You must know How many frames does the animation have
                                 if (progress == 90) {
                                   contanierForAnimationId?.visibility = View.GONE
                                 }
                             }
                          } 
                      
                      
                        return view
                      }
                      
                       <RelativeLayout
                         android:id="@+id/contanierForAnimationId"
                         android:layout_width="50dp"
                         android:layout_height="50dp"
                         android:visibility="visible">
                            <com.airbnb.lottie.LottieAnimationView
                                android:id="@+id/aLottieAnimationId"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                app:lottie_autoPlay="false"
                                app:lottie_fileName="animation.json"
                                app:lottie_repeatCount="0" />
                      </RelativeLayout>
                      
                      var aLottieAnimationId : LottieAnimationView? = null
                      var contanierForAnimationId: RelativeLayout? = null
                      
                      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 
                      savedInstanceState: Bundle?): View? {
                      
                          val view = inflater.inflate( R.layout.my_Layout, container, false )
                          aLottieAnimationId = view.findViewById(R.id.aLottieAnimationId) as LottieAnimationView
                      contanierForAnimationId = view.findViewById(R.id.contanierForAnimationId) as RelativeLayout
                      
                      
                          aLottieAnimationId?.setOnClickListener {
                            aLottieAnimationId?.setOnClickListener(null)
                            aLottieAnimationId?.speed = 1f
                            aLottieAnimationId?.playAnimation()
                            aLottieAnimationId?.setMinAndMaxFrame(0, 90) //How many frames does the animation have
                             aLottieAnimationId?.addAnimatorUpdateListener { valueAnimator ->
                               // Set animation progress
                                 val progress = (valueAnimator.animatedValue as Float * 100).toInt()
                                 Log.d("progress :","$progress")
                               //You must know How many frames does the animation have
                                 if (progress == 90) {
                                   contanierForAnimationId?.visibility = View.GONE
                                 }
                             }
                          } 
                      
                      
                        return view
                      }
                      
                      successAnimation.addAnimatorListener(object : Animator.AnimatorListener{
                                  override fun onAnimationRepeat(animation: Animator?) {
                                  }
                      
                                  override fun onAnimationEnd(animation: Animator?) {
                                      //Add your code here for animation end
                                  }
                      
                                  override fun onAnimationCancel(animation: Animator?) {
                                  }
                      
                                  override fun onAnimationStart(animation: Animator?) {
                                  }
                      
                              })
                      

                      Lottie Android: add color overlay to animation

                      copy iconCopydownload iconDownload
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("checkmark", "**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.CYAN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(new KeyPath("**"), LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return null;
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("checkmark", "**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.CYAN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(new KeyPath("**"), LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return null;
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(
                              new KeyPath("checkmark", "**"),
                              LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return new PorterDuffColorFilter(Color.CYAN, PorterDuff.Mode.SRC_ATOP);
                                  }
                              }
                      );
                      
                      LottieAnimationView animationView = findViewById(R.id.animation_view);
                      animationView.addValueCallback(new KeyPath("**"), LottieProperty.COLOR_FILTER,
                              new SimpleLottieValueCallback<ColorFilter>() {
                                  @Override
                                  public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
                                      return null;
                                  }
                              }
                      );
                      
                      int yourColor = ContextCompat.getColor(getContext(),R.color.colorPrimary);
                      
                      SimpleColorFilter filter = new SimpleColorFilter(yourColor);
                      KeyPath keyPath = new KeyPath("**");
                      LottieValueCallback<ColorFilter> callback = new LottieValueCallback<ColorFilter>(filter);
                      animationView.addValueCallback(keyPath, LottieProperty.COLOR_FILTER, callback);
                      
                      int yourColor = ContextCompat.getColor(getContext(),R.color.colorPrimary);
                      
                      SimpleColorFilter filter = new SimpleColorFilter(yourColor);
                      KeyPath keyPath = new KeyPath("**");
                      LottieValueCallback<ColorFilter> callback = new LottieValueCallback<ColorFilter>(filter);
                      animationView.addValueCallback(keyPath, LottieProperty.COLOR_FILTER, callback);
                      
                      "sc": "#6664e7"
                      

                      Is it possible to add custom drawable to imageView in an Android Home Screen Widget?

                      copy iconCopydownload iconDownload
                      Paint p = new Paint(); 
                      p.setAntiAlias(true);
                      p.setStyle(Style.STROKE);
                      p.setStrokeWidth(8);
                      p.setColor(0xFFFF0000);
                      
                      Bitmap bitmap = Bitmap.createBitmap(100, 100, 
                      Config.ARGB_8888);
                      Canvas canvas = new Canvas(bitmap);
                      canvas.drawArc(new RectF(10, 10, 90, 90), 0, 270, false, p);
                      
                      RemoteViews views = new 
                      RemoteViews(updateService.getPackageName(), R.layout.main);
                      views.setImageViewBitmap(R.id.canvas, bitmap);
                      
                      ComponentName componentName = new 
                      ComponentName(updateService, 
                      DashboardAppWidgetProvider.class);
                      AppWidgetManager appWidgetManager = 
                      AppWidgetManager.getInstance(updateService);
                      appWidgetManager.updateAppWidget(componentName, 
                      views);
                      

                      How to interpret and translate kotlin code to java?

                      copy iconCopydownload iconDownload
                      private void setViewPagerScroller() {
                          try {
                              Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
                              scrollerField.setAccessible(true);
                      
                              Field interpolator = ViewPager.class.getDeclaredField("sInterpolator");
                              interpolator.setAccessible(true);
                      
                              Scroller scroller = new Scroller(this, (android.view.animation.Interpolator) interpolator.get(null)){
                      
                                  @Override
                                  public void startScroll(int startX, int startY, int dx, int dy, int duration) {
                                      super.startScroll(startX, startY, dx, dy, duration * 7);
                                  }
                              }
                      
                              scrollerField.set(viewPager, scroller);
                          } catch (NoSuchFieldException error) {
                              // Do nothing.
                          } catch (IllegalAccessException error) {
                              // Do nothing.
                          }
                      }
                      
                      private LockableViewPager viewPager;
                      
                      private LockableViewPager getViewPager(){
                          if(viewPager == null){
                              // produce viewpager and store in field
                          }
                          return viewPager;
                      }  
                      
                      private void setViewPagerScroller() {
                          try {
                              Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
                              scrollerField.setAccessible(true);
                      
                              Field interpolator = ViewPager.class.getDeclaredField("sInterpolator");
                              interpolator.setAccessible(true);
                      
                              Scroller scroller = new Scroller(this, (android.view.animation.Interpolator) interpolator.get(null)){
                      
                                  @Override
                                  public void startScroll(int startX, int startY, int dx, int dy, int duration) {
                                      super.startScroll(startX, startY, dx, dy, duration * 7);
                                  }
                              }
                      
                              scrollerField.set(viewPager, scroller);
                          } catch (NoSuchFieldException error) {
                              // Do nothing.
                          } catch (IllegalAccessException error) {
                              // Do nothing.
                          }
                      }
                      
                      private LockableViewPager viewPager;
                      
                      private LockableViewPager getViewPager(){
                          if(viewPager == null){
                              // produce viewpager and store in field
                          }
                          return viewPager;
                      }  
                      

                      Gradle dependency conflict between library and project android

                      copy iconCopydownload iconDownload
                      allprojects {
                          repositories {
                              jcenter()
                              maven {
                                  url "https://maven.google.com"
                              }
                          }
                      }
                      
                      dependencies {
                          def supportLibrariesVersion = '26.1.0'
                      
                          compile "com.android.support:support-compat:${supportLibrariesVersion}"
                          compile "com.android.support:cardview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:recyclerview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:gridlayout-v7:${supportLibrariesVersion}"
                          compile "com.android.support:design:${supportLibrariesVersion}"
                      }
                      
                      compileSdkVersion 26
                      buildToolsVersion "26.0.1"
                      
                      allprojects {
                          repositories {
                              jcenter()
                              maven {
                                  url "https://maven.google.com"
                              }
                          }
                      }
                      
                      dependencies {
                          def supportLibrariesVersion = '26.1.0'
                      
                          compile "com.android.support:support-compat:${supportLibrariesVersion}"
                          compile "com.android.support:cardview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:recyclerview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:gridlayout-v7:${supportLibrariesVersion}"
                          compile "com.android.support:design:${supportLibrariesVersion}"
                      }
                      
                      compileSdkVersion 26
                      buildToolsVersion "26.0.1"
                      
                      allprojects {
                          repositories {
                              jcenter()
                              maven {
                                  url "https://maven.google.com"
                              }
                          }
                      }
                      
                      dependencies {
                          def supportLibrariesVersion = '26.1.0'
                      
                          compile "com.android.support:support-compat:${supportLibrariesVersion}"
                          compile "com.android.support:cardview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:recyclerview-v7:${supportLibrariesVersion}"
                          compile "com.android.support:gridlayout-v7:${supportLibrariesVersion}"
                          compile "com.android.support:design:${supportLibrariesVersion}"
                      }
                      
                      compileSdkVersion 26
                      buildToolsVersion "26.0.1"
                      
                      repositories {
                          google()
                      }
                      
                      repositories {
                          maven {
                              url "https://maven.google.com"
                          }
                      }
                      
                      repositories {
                          google()
                      }
                      
                      repositories {
                          maven {
                              url "https://maven.google.com"
                          }
                      }
                      

                      Lottie animation slow android

                      copy iconCopydownload iconDownload
                        final LottieAnimationView animationView = (LottieAnimationView) findViewById(R.id.animation_view);
                        animationView.useExperimentalHardwareAcceleration(true);
                        animationView.enableMergePathsForKitKatAndAbove(true);
                      

                      Community Discussions

                      Trending Discussions on lottie-android
                      • How to know when lottie animation is completed?
                      • Lottie Android: add color overlay to animation
                      • Lottie Android - Using Lottie Android with vector image (xml) or svg image?
                      • Is it possible to add custom drawable to imageView in an Android Home Screen Widget?
                      • How to interpret and translate kotlin code to java?
                      • Gradle dependency conflict between library and project android
                      • Lottie animation slow android
                      Trending Discussions on lottie-android

                      QUESTION

                      How to know when lottie animation is completed?

                      Asked 2020-May-20 at 16:13

                      I have a fragment, here is the onCreateView method:

                      @Override
                      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                      
                          // Inflate the layout for this fragment
                          mView = inflater.inflate(R.layout.fragment_added_to_cart_anim, container, false);
                          ButterKnife.bind(this, mView);
                      
                          mAddedToCartAnimation.setAnimation("checked_done_.json");
                          mAddedToCartAnimation.loop(false);
                          mAddedToCartAnimation.playAnimation();
                      
                          // Remove fragment when the animation is finished.
                      
                          return mView;
                      
                      }
                      

                      I need to remove the fragment using getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit(); when the lottie animation has ended. If I understand correctly when the isAnimating() Lottie method returns false the animation has ended and since in my configuration the animation does not loop this is when I should remove the current fragment. But I can't just use an if statement since when it is executed the animation may still be going.

                      I need a way to remove the fragment when the Lottie animation ends, how do I do this?

                      ANSWER

                      Answered 2017-Sep-12 at 16:17

                      This code works for me:

                      mAddedToCartAnimation.addAnimatorListener(new Animator.AnimatorListener() {
                              @Override
                              public void onAnimationStart(Animator animation) {
                                  Log.e("Animation:","start");
                              }
                      
                              @Override
                              public void onAnimationEnd(Animator animation) {
                                  Log.e("Animation:","end");
                                  //Your code for remove the fragment
                                  try {
                                      getActivity().getSupportFragmentManager()
                                            .beginTransaction().remove(this).commit();
                                  } catch(Exception ex) {
                                      ex.toString();
                                  }
                              }
                      
                              @Override
                              public void onAnimationCancel(Animator animation) {
                                  Log.e("Animation:","cancel");
                              }
                      
                              @Override
                              public void onAnimationRepeat(Animator animation) {
                                  Log.e("Animation:","repeat");
                              }
                          });
                      

                      I hope this solve your problem :)

                      Source https://stackoverflow.com/questions/46180874

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install lottie-android

                      Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:.

                      Support

                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                      DOWNLOAD this Library from

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Share this Page

                      share link
                      Reuse Pre-built Kits with lottie-android
                      Consider Popular Animation Libraries
                      Try Top Libraries by airbnb
                      Compare Animation Libraries with Highest Support
                      Compare Animation Libraries with Highest Quality
                      Compare Animation Libraries with Highest Security
                      Compare Animation Libraries with Permissive License
                      Compare Animation Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      • © 2022 Open Weaver Inc.