Skip to content

Thanos snaps his fingers, and a half avengers disappear.

Notifications You must be signed in to change notification settings

Brooks0129/ThanosSnap

Repository files navigation

The animated effect was inspired by the scene of the Avengers disappearing after the Thanos snaps fingers in the Avengers 3.

在这里插入图片描述

Here are Demo:

在这里插入图片描述

Instead of just animating the ImageView, we animate the parent view that contains the ImageView.

This animation can be used on most View and viewGroup. The above example is animating the Item in Recyclerview.

For Chinese explanation, visit here

Usage

Import dependency

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.Brooks0129:ThanosSnap:v1.0'
	}

Call method

Kotlin:

        val disappearView = DisappearView.attach(activity)
        disappearView.execute(view, 
            duration = 4000, 
            interpolator = AccelerateInterpolator(0.5f),
            needDisappear = true)

DisappearView.attach(activity),here should pass an activity instance。 call disappearView.execute indicates that the animation is started, and the meaning of each parameter is explained below.

  • view, Indicates the view that needs to be animated. It can be a single View or a ViewGroup.
  • duration, Indicates the time when the animation is executed. You can leave it blank. The default is 4m.
  • interpolator, Animated interpolator, you can leave it blank. The default is AccelerateInterpolator(0.5f)
  • needDisappear, Indicates whether the original view should disappear when the animation is executed. You can leave it blank and the default disappears.

If it is a java call, you can choose the corresponding overload method.

Limit

DisappearView.attach(activity),Only one activity instance can be passed, so if the current context is not an activity, then the animation is temporarily unavailable. For example, in Dialog.

Todo

Support Dialog and other non-Activity

Various animation directions

Diverse styles of each element

Currently every element of the motion is a rectangle, and then round and custom graphics are supported.

About

Thanos snaps his fingers, and a half avengers disappear.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published