github地址:https://github.com/2359media/EasyAndroidAnimations
可以将Demo下载下来看看动画的效果。
在studio中添加:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
}
多种动画代码,需要什么效果,就在代码中把自己的view添加进去就OK。
case 1:
new BlindAnimation(card).animate();
isFinished = true;
break;
case 2:
new BlinkAnimation(card).setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 3:
new BounceAnimation(card).setNumOfBounces(3)
.setDuration(Animation.DURATION_SHORT)
.setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 4:
new ExplodeAnimation(card).animate();
isFinished = true;
break;
case 5:
new FadeInAnimation(card).animate();
isFinished = true;
break;
case 6:
new FadeOutAnimation(card).animate();
isFinished = true;
break;
case 7:
new FlipHorizontalAnimation(card).setListener(
new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 8:
new FlipHorizontalToAnimation(card).setFlipToView(card2)
.setInterpolator(new LinearInterpolator()).animate();
isFinished = true;
break;
case 9:
new FlipVerticalAnimation(card).setListener(
new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 10:
new FlipVerticalToAnimation(card).setFlipToView(card2)
.setInterpolator(new LinearInterpolator()).animate();
isFinished = true;
break;
case 11:
card2.setVisibility(View.VISIBLE);
new UnfoldAnimation(card).setNumOfFolds(10).setDuration(1000)
.setOrientation(Orientation.HORIZONTAL).animate();
isFinished = true;
break;
case 12:
card2.setVisibility(View.VISIBLE);
new FoldAnimation(card).setNumOfFolds(10).setDuration(1000)
.setOrientation(Orientation.VERTICAL).animate();
isFinished = true;
break;
case 13:
new HighlightAnimation(card).setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 14:
ArrayList<Point> points = new ArrayList<>();
points.add(new Point(0, 100));
points.add(new Point(50, 0));
points.add(new Point(100, 100));
points.add(new Point(0, 50));
points.add(new Point(100, 50));
points.add(new Point(0, 100));
points.add(new Point(50, 50));
new PathAnimation(card).setPoints(points).setDuration(2000)
.setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 15:
new PuffInAnimation(card).animate();
isFinished = true;
break;
case 16:
new PuffOutAnimation(card).animate();
isFinished = true;
break;
case 17:
new RotationAnimation(card)
.setPivot(RotationAnimation.PIVOT_TOP_LEFT)
.setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 18:
new ScaleInAnimation(card).animate();
isFinished = true;
break;
case 19:
new ScaleOutAnimation(card).animate();
isFinished = true;
break;
case 20:
new ShakeAnimation(card).setNumOfShakes(3)
.setDuration(Animation.DURATION_SHORT)
.setListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
mPlayView.setVisibility(View.VISIBLE);
}
}).animate();
break;
case 21:
new SlideInAnimation(card).setDirection(Animation.DIRECTION_UP)
.animate();
isFinished = true;
break;
case 22:
new SlideInUnderneathAnimation(card).setDirection(
Animation.DIRECTION_DOWN).animate();
isFinished = true;
break;
case 23:
new SlideOutAnimation(card).setDirection(Animation.DIRECTION_LEFT)
.animate();
isFinished = true;
break;
case 24:
new SlideOutUnderneathAnimation(card).setDirection(
Animation.DIRECTION_RIGHT).animate();
isFinished = true;
break;
case 25:
new TransferAnimation(card).setDestinationView(target).animate();
break;