public Morpho reverse(AnimationType type, int duration, Interpolator interpolator) {
boolean animationPartsIsConfigured = this.animationParts != null && this.animationParts.size() > 0;
boolean coreViewIsInitialized = this.viewToMorph != null && this.viewDefault != null;
boolean animationIsNotRunning = this.completeAnimation != null && !this.completeAnimation.isRunning();
if (animationPartsIsConfigured && coreViewIsInitialized && animationIsNotRunning) {
this.completeAnimation = new AnimatorSet();
ArrayList<Animation> reversedAnimationParts = new ArrayList<>();
reversedAnimationParts.addAll(animationParts);
Collections.reverse(reversedAnimationParts);
ArrayList<Animator> animators = new ArrayList<>();
for (Animation a : reversedAnimationParts) {
animators.add(a.buildAnimation(this.viewDefault, this.viewToMorph, true));
}
// Type of Animation
if (type == AnimationType.SEQUENTIAL) {
this.completeAnimation.playSequentially(animators);
} else {
this.completeAnimation.playTogether(animators);
}
// Duration
if (duration >= 0) {
this.completeAnimation.setDuration(duration);
}
// Interpolator
if (interpolator != null) {
this.completeAnimation.setInterpolator(interpolator);
}
this.completeAnimation.start();
this.completeAnimation = null;
}
return this;
}
Morpho.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:morphos
作者:
评论列表
文章目录