Search in sources :

Example 1 with BackOut

use of no.agens.depth.lib.tween.interpolators.BackOut in project Depth-LIB-Android- by danielzeller.

the class TransitionHelper method revertFromMenu.

static ObjectAnimator revertFromMenu(final DepthLayout target, final float customElevation, int subtractDelay, float targetElevation) {
    target.setPivotY(getDistanceToCenter(target));
    target.setPivotX(getDistanceToCenterX(target));
    target.setCameraDistance(10000 * target.getResources().getDisplayMetrics().density);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, 0).setDuration(700);
    translationY.setInterpolator(new BackOut());
    translationY.setStartDelay(250 + FISRTDELAY + subtractDelay);
    translationY.start();
    ObjectAnimator rotationX = ObjectAnimator.ofFloat(target, View.ROTATION_X, target.getRotationX(), 0).setDuration(1000);
    rotationX.setInterpolator(new QuintInOut());
    rotationX.setStartDelay(FISRTDELAY + subtractDelay);
    rotationX.start();
    target.setRotationX(TARGET_ROTATION_X);
    ObjectAnimator elevation = ObjectAnimator.ofFloat(target, "CustomShadowElevation", target.getCustomShadowElevation(), targetElevation * target.getResources().getDisplayMetrics().density).setDuration(1000);
    elevation.setInterpolator(new QuintInOut());
    elevation.setStartDelay(FISRTDELAY + subtractDelay * 2);
    elevation.start();
    target.setCustomShadowElevation(customElevation * target.getResources().getDisplayMetrics().density);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, target.getScaleX(), 1f).setDuration(1000);
    scaleX.setInterpolator(new CircInOut());
    scaleX.setStartDelay(FISRTDELAY + subtractDelay);
    scaleX.start();
    target.setScaleX(TARGET_SCALE);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, target.getScaleY(), 1f).setDuration(1000);
    scaleY.setInterpolator(new CircInOut());
    scaleY.setStartDelay(FISRTDELAY + subtractDelay);
    scaleY.start();
    target.setScaleY(TARGET_SCALE);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, target.getRotation(), 0).setDuration(1100);
    rotation.setInterpolator(new QuintInOut());
    rotation.setStartDelay(subtractDelay);
    rotation.start();
    rotation.addListener(getShowStatusBarListener(target));
    return scaleY;
}
Also used : CircInOut(no.agens.depth.lib.tween.interpolators.CircInOut) BackOut(no.agens.depth.lib.tween.interpolators.BackOut) ObjectAnimator(android.animation.ObjectAnimator) QuintInOut(no.agens.depth.lib.tween.interpolators.QuintInOut)

Example 2 with BackOut

use of no.agens.depth.lib.tween.interpolators.BackOut in project Depth-LIB-Android- by danielzeller.

the class TransitionHelper method introAnimate.

static ObjectAnimator introAnimate(final DepthLayout target, final float moveY, final float customElevation, long delay, int subtractDelay) {
    target.setPivotY(getDistanceToCenter(target));
    target.setPivotX(getDistanceToCenterX(target));
    target.setCameraDistance(10000 * target.getResources().getDisplayMetrics().density);
    ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, target.getResources().getDisplayMetrics().heightPixels, -moveY * target.getResources().getDisplayMetrics().density).setDuration(800);
    translationY2.setInterpolator(new ExpoOut());
    translationY2.setStartDelay(700 + subtractDelay);
    translationY2.start();
    target.setTranslationY(target.getResources().getDisplayMetrics().heightPixels);
    ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, -target.getResources().getDisplayMetrics().widthPixels, 0).setDuration(800);
    translationX2.setInterpolator(new ExpoOut());
    translationX2.setStartDelay(700 + subtractDelay);
    translationX2.start();
    target.setTranslationX(-target.getResources().getDisplayMetrics().widthPixels);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, 0).setDuration(700);
    translationY.setInterpolator(new BackOut());
    translationY.setStartDelay(700 + 800);
    translationY.start();
    ObjectAnimator rotationX = ObjectAnimator.ofFloat(target, View.ROTATION_X, TARGET_ROTATION_X, 0).setDuration(1000);
    rotationX.setInterpolator(new QuintInOut());
    rotationX.setStartDelay(700 + FISRTDELAY + subtractDelay);
    rotationX.start();
    target.setRotationX(TARGET_ROTATION_X);
    ObjectAnimator elevation = ObjectAnimator.ofFloat(target, "CustomShadowElevation", customElevation * target.getResources().getDisplayMetrics().density, target.getCustomShadowElevation()).setDuration(1000);
    elevation.setInterpolator(new QuintInOut());
    elevation.setStartDelay(700 + FISRTDELAY + subtractDelay * 2);
    elevation.start();
    target.setCustomShadowElevation(customElevation * target.getResources().getDisplayMetrics().density);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, TARGET_SCALE, target.getScaleX()).setDuration(1000);
    scaleX.setInterpolator(new CircInOut());
    scaleX.setStartDelay(700 + FISRTDELAY + subtractDelay);
    scaleX.start();
    target.setScaleX(TARGET_SCALE);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, TARGET_SCALE, target.getScaleY()).setDuration(1000);
    scaleY.setInterpolator(new CircInOut());
    scaleY.setStartDelay(700 + FISRTDELAY + subtractDelay);
    scaleY.start();
    target.setScaleY(TARGET_SCALE);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, TARGET_ROTATION, 0).setDuration(1400);
    rotation.setInterpolator(new QuadInOut());
    rotation.setStartDelay(FISRTDELAY + subtractDelay);
    rotation.start();
    target.setRotation(TARGET_ROTATION);
    rotation.addListener(getShowStatusBarListener(target));
    return scaleY;
}
Also used : CircInOut(no.agens.depth.lib.tween.interpolators.CircInOut) BackOut(no.agens.depth.lib.tween.interpolators.BackOut) ObjectAnimator(android.animation.ObjectAnimator) QuintInOut(no.agens.depth.lib.tween.interpolators.QuintInOut) QuadInOut(no.agens.depth.lib.tween.interpolators.QuadInOut) ExpoOut(no.agens.depth.lib.tween.interpolators.ExpoOut)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)2 BackOut (no.agens.depth.lib.tween.interpolators.BackOut)2 CircInOut (no.agens.depth.lib.tween.interpolators.CircInOut)2 QuintInOut (no.agens.depth.lib.tween.interpolators.QuintInOut)2 ExpoOut (no.agens.depth.lib.tween.interpolators.ExpoOut)1 QuadInOut (no.agens.depth.lib.tween.interpolators.QuadInOut)1