use of com.nineoldandroids.animation.ObjectAnimator in project Context-Menu.Android by Yalantis.
the class MenuAdapter method buildChosenAnimation.
/**
* Builds and runs chosen item and menu closing animation
*/
private void buildChosenAnimation(int childIndex) {
List<Animator> fadeOutTextTopAnimatorList = new ArrayList<>();
List<Animator> closeToBottomImageAnimatorList = new ArrayList<>();
for (int i = 0; i < childIndex; i++) {
View view = mMenuWrapper.getChildAt(i);
resetVerticalAnimation(view, true);
closeToBottomImageAnimatorList.add(AnimatorUtils.rotationCloseVertical(view));
fadeOutTextTopAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i), mContext.getResources().getDimension(R.dimen.text_right_translation)));
}
AnimatorSet closeToBottom = new AnimatorSet();
closeToBottom.playSequentially(closeToBottomImageAnimatorList);
AnimatorSet fadeOutTop = new AnimatorSet();
fadeOutTop.playSequentially(fadeOutTextTopAnimatorList);
List<Animator> fadeOutTextBottomAnimatorList = new ArrayList<>();
List<Animator> closeToTopAnimatorObjects = new ArrayList<>();
for (int i = getItemCount() - 1; i > childIndex; i--) {
View view = mMenuWrapper.getChildAt(i);
resetVerticalAnimation(view, false);
closeToTopAnimatorObjects.add(AnimatorUtils.rotationCloseVertical(view));
fadeOutTextBottomAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i), mContext.getResources().getDimension(R.dimen.text_right_translation)));
}
AnimatorSet closeToTop = new AnimatorSet();
closeToTop.playSequentially(closeToTopAnimatorObjects);
AnimatorSet fadeOutBottom = new AnimatorSet();
fadeOutBottom.playSequentially(fadeOutTextBottomAnimatorList);
resetSideAnimation(mMenuWrapper.getChildAt(childIndex));
ObjectAnimator closeToRight = AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(childIndex));
closeToRight.addListener(mChosenItemFinishAnimatorListener);
AnimatorSet fadeOutChosenText = AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(childIndex), mContext.getResources().getDimension(R.dimen.text_right_translation));
AnimatorSet imageFullAnimatorSet = new AnimatorSet();
imageFullAnimatorSet.play(closeToBottom).with(closeToTop);
AnimatorSet textFullAnimatorSet = new AnimatorSet();
textFullAnimatorSet.play(fadeOutTop).with(fadeOutBottom);
if (closeToBottomImageAnimatorList.size() >= closeToTopAnimatorObjects.size()) {
imageFullAnimatorSet.play(closeToBottom).before(closeToRight);
textFullAnimatorSet.play(fadeOutTop).before(fadeOutChosenText);
} else {
imageFullAnimatorSet.play(closeToTop).before(closeToRight);
textFullAnimatorSet.play(fadeOutBottom).before(fadeOutChosenText);
}
AnimatorSet fullAnimatorSet = new AnimatorSet();
fullAnimatorSet.playTogether(imageFullAnimatorSet, textFullAnimatorSet);
fullAnimatorSet.setDuration(mAnimationDurationMilis);
fullAnimatorSet.setInterpolator(new HesitateInterpolator());
fullAnimatorSet.start();
}
use of com.nineoldandroids.animation.ObjectAnimator in project Carbon by ZieIony.
the class RippleForeground method createSoftwareEnter.
@Override
protected Animator createSoftwareEnter(boolean fast) {
// Bounded ripples don't have enter animations.
if (mIsBounded) {
return null;
}
final int duration = (int) (1000 * Math.sqrt(mTargetRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5);
final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1);
AnimatorsCompat.setAutoCancel(tweenRadius);
// tweenRadius.setAutoCancel(true);
tweenRadius.setDuration(duration);
tweenRadius.setInterpolator(LINEAR_INTERPOLATOR);
tweenRadius.setStartDelay(RIPPLE_ENTER_DELAY);
final ObjectAnimator tweenOrigin = ObjectAnimator.ofFloat(this, TWEEN_ORIGIN, 1);
AnimatorsCompat.setAutoCancel(tweenOrigin);
// tweenOrigin.setAutoCancel(true);
tweenOrigin.setDuration(duration);
tweenOrigin.setInterpolator(LINEAR_INTERPOLATOR);
tweenOrigin.setStartDelay(RIPPLE_ENTER_DELAY);
final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1);
AnimatorsCompat.setAutoCancel(opacity);
// opacity.setAutoCancel(true);
opacity.setDuration(OPACITY_ENTER_DURATION_FAST);
opacity.setInterpolator(LINEAR_INTERPOLATOR);
final AnimatorSet set = new AnimatorSet();
set.play(tweenOrigin).with(tweenRadius).with(opacity);
return set;
}
use of com.nineoldandroids.animation.ObjectAnimator in project Carbon by ZieIony.
the class RippleBackground method createSoftwareEnter.
@Override
protected Animator createSoftwareEnter(boolean fast) {
// Linear enter based on current opacity.
final int maxDuration = fast ? OPACITY_ENTER_DURATION_FAST : OPACITY_ENTER_DURATION;
final int duration = (int) ((1 - mOpacity) * maxDuration);
final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1);
AnimatorsCompat.setAutoCancel(opacity);
//opacity.setAutoCancel(true);
opacity.setDuration(duration);
opacity.setInterpolator(LINEAR_INTERPOLATOR);
return opacity;
}
use of com.nineoldandroids.animation.ObjectAnimator in project Carbon by ZieIony.
the class RippleBackground method createSoftwareExit.
@Override
protected Animator createSoftwareExit() {
final AnimatorSet set = new AnimatorSet();
// Linear exit after enter is completed.
final ObjectAnimator exit = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 0);
exit.setInterpolator(LINEAR_INTERPOLATOR);
exit.setDuration(OPACITY_EXIT_DURATION);
AnimatorsCompat.setAutoCancel(exit);
//exit.setAutoCancel(true);
final AnimatorSet.Builder builder = set.play(exit);
// Linear "fast" enter based on current opacity.
final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST);
if (fastEnterDuration > 0) {
final ObjectAnimator enter = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 1);
enter.setInterpolator(LINEAR_INTERPOLATOR);
enter.setDuration(fastEnterDuration);
AnimatorsCompat.setAutoCancel(enter);
//enter.setAutoCancel(true);
builder.after(enter);
}
return set;
}
use of com.nineoldandroids.animation.ObjectAnimator in project MaterialDesignLibrary by navasmdc.
the class ButtonFloat method show.
public void show() {
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = true;
}
Aggregations