use of android.animation.ObjectAnimator in project kickmaterial by byoutline.
the class CircleTransition method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
Rect startBounds = (Rect) startValues.values.get(PROPERTY_BOUNDS);
Rect endBounds = (Rect) endValues.values.get(PROPERTY_BOUNDS);
boolean boundsEqual = startBounds == null || endBounds == null || startBounds.equals(endBounds);
if (boundsEqual) {
return null;
}
int[] sceneRootLoc = new int[2];
sceneRoot.getLocationInWindow(sceneRootLoc);
int[] startLoc = (int[]) startValues.values.get(PROPERTY_POSITION);
final View startView = getStartView(sceneRoot, startValues, sceneRootLoc, startLoc);
final View endView = endValues.view;
endView.setAlpha(0f);
Path circlePath = getMovePath(endValues, startView, sceneRootLoc, startLoc, endView);
Animator circleAnimator = ObjectAnimator.ofFloat(startView, View.TRANSLATION_X, View.TRANSLATION_Y, circlePath);
circleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
startView.setVisibility(View.INVISIBLE);
endView.setAlpha(1f);
sceneRoot.getOverlay().remove(startView);
}
});
AnimatorSet moveSet = new AnimatorSet();
float scaleRatio = ((float) endView.getWidth()) / startView.getWidth();
ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_X, 1, scaleRatio);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_Y, 1, scaleRatio);
moveSet.playTogether(circleAnimator, scaleXAnimator, scaleYAnimator);
return moveSet;
}
use of android.animation.ObjectAnimator in project Depth-LIB-Android- by danielzeller.
the class TransitionHelper method continueOutToRight.
private static void continueOutToRight(DepthLayout target, float moveY, int subtractDelay) {
ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, -moveY * target.getResources().getDisplayMetrics().density, -target.getResources().getDisplayMetrics().heightPixels).setDuration(900);
translationY2.setInterpolator(new ExpoIn());
translationY2.setStartDelay(0 + subtractDelay);
translationY2.start();
ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, target.getTranslationX(), target.getResources().getDisplayMetrics().widthPixels).setDuration(900);
translationX2.setInterpolator(new ExpoIn());
translationX2.setStartDelay(0 + subtractDelay);
translationX2.start();
}
use of android.animation.ObjectAnimator in project Depth-LIB-Android- by danielzeller.
the class TransitionHelper method startRevertFromMenu.
public static void startRevertFromMenu(View root, AnimatorListenerAdapter animatorListenerAdapter) {
revertFromMenu((DepthLayout) root.findViewById(R.id.root_dl), 30f, 10, 0);
revertFromMenu((DepthLayout) root.findViewById(R.id.appbar), 20f, 0, 0);
revertFromMenu((DepthLayout) root.findViewById(R.id.fab_container), 20f, 20, 6);
revertFromMenu((DepthLayout) root.findViewById(R.id.dl2), 20f, 30, 1);
revertFromMenu((DepthLayout) root.findViewById(R.id.dl3), 20f, 40, 2).addListener(animatorListenerAdapter);
ObjectAnimator translationY = ObjectAnimator.ofFloat(root, View.TRANSLATION_Y, 0).setDuration(DURATION);
translationY.setInterpolator(new QuintInOut());
translationY.start();
}
use of android.animation.ObjectAnimator 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;
}
use of android.animation.ObjectAnimator in project Depth-LIB-Android- by danielzeller.
the class TransitionHelper method animateToMenuState.
public static void animateToMenuState(View root, AnimatorListenerAdapter onMenuAnimFinished) {
hideStatusBar(root);
exitAnimate((DepthLayout) root.findViewById(R.id.root_dl), 0, 30f, 15, 190, false);
exitAnimate((DepthLayout) root.findViewById(R.id.appbar), MOVE_Y_STEP, 20f, 30, 170, false);
exitAnimate((DepthLayout) root.findViewById(R.id.fab_container), MOVE_Y_STEP * 2f, 20f, 45, 210, false);
exitAnimate((DepthLayout) root.findViewById(R.id.dl2), MOVE_Y_STEP, 20f, 60, 230, false);
exitAnimate((DepthLayout) root.findViewById(R.id.dl3), MOVE_Y_STEP * 2, 20f, 75, 250, false).addListener(onMenuAnimFinished);
ObjectAnimator translationY = ObjectAnimator.ofFloat(root, View.TRANSLATION_Y, -90f * root.getResources().getDisplayMetrics().density).setDuration(DURATION);
translationY.setInterpolator(VALUEinterpolator);
translationY.start();
}
Aggregations