use of android.view.animation.OvershootInterpolator in project AndroidSweetSheet by zzz40500.
the class MenuRVAdapter method animation.
private void animation(MenuVH menuVH) {
ViewHelper.setAlpha(menuVH.itemView, 0);
ViewHelper.setTranslationY(menuVH.itemView, 300);
ObjectAnimator translationY = ObjectAnimator.ofFloat(menuVH.itemView, "translationY", 500, 0);
translationY.setDuration(300);
translationY.setInterpolator(new OvershootInterpolator(1.6f));
ObjectAnimator alphaIn = ObjectAnimator.ofFloat(menuVH.itemView, "alpha", 0, 1);
alphaIn.setDuration(100);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translationY, alphaIn);
animatorSet.setStartDelay(30 * menuVH.getAdapterPosition());
animatorSet.start();
}
use of android.view.animation.OvershootInterpolator in project 500px-android-blur by 500px.
the class MainActivity method shift.
public void shift(View view) {
if (!mShifted) {
for (ImageView imageView : mImageViews) {
ObjectAnimator tx = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, (mRandom.nextFloat() - 0.5f) * 500);
tx.addUpdateListener(listener);
ObjectAnimator ty = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_Y, (mRandom.nextFloat() - 0.5f) * 500);
ty.addUpdateListener(listener);
AnimatorSet set = new AnimatorSet();
set.playTogether(tx, ty);
set.setDuration(3000);
set.setInterpolator(new OvershootInterpolator());
set.addListener(new AnimationEndListener(imageView));
set.start();
}
mShifted = true;
} else {
for (ImageView imageView : mImageViews) {
ObjectAnimator tx = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, 0);
tx.addUpdateListener(listener);
ObjectAnimator ty = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_Y, 0);
ty.addUpdateListener(listener);
AnimatorSet set = new AnimatorSet();
set.playTogether(tx, ty);
set.setDuration(3000);
set.setInterpolator(new OvershootInterpolator());
set.addListener(new AnimationEndListener(imageView));
set.start();
}
mShifted = false;
}
}
use of android.view.animation.OvershootInterpolator in project UltimateAndroid by cymcsg.
the class ArcLayout method bindChildAnimation.
private void bindChildAnimation(final View child, final int index, final long duration) {
final boolean expanded = mExpanded;
final int centerX = getWidth() / 2;
final int centerY = getHeight() / 2;
final int radius = expanded ? 0 : mRadius;
final int childCount = getChildCount();
final float perDegrees = (mToDegrees - mFromDegrees) / (childCount - 1);
Rect frame = computeChildFrame(centerX, centerY, radius, mFromDegrees + index * perDegrees, mChildSize);
final int toXDelta = frame.left - child.getLeft();
final int toYDelta = frame.top - child.getTop();
Interpolator interpolator = mExpanded ? new AccelerateInterpolator() : new OvershootInterpolator(1.5f);
final long startOffset = computeStartOffset(childCount, mExpanded, index, 0.1f, duration, interpolator);
Animation animation = mExpanded ? createShrinkAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator) : createExpandAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator);
final boolean isLast = getTransformedIndex(expanded, childCount, index) == childCount - 1;
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (isLast) {
postDelayed(new Runnable() {
@Override
public void run() {
onAllAnimationsEnd();
}
}, 0);
}
}
});
child.setAnimation(animation);
}
use of android.view.animation.OvershootInterpolator in project UltimateAndroid by cymcsg.
the class FloatingActionsMenu method createAddButton.
private void createAddButton(Context context) {
mAddButton = new AddFloatingActionButton(context) {
@Override
void updateBackground() {
mPlusColor = mAddButtonPlusColor;
mColorNormal = mAddButtonColorNormal;
mColorPressed = mAddButtonColorPressed;
super.updateBackground();
}
@Override
Drawable getIconDrawable() {
final RotatingDrawable rotatingDrawable = new RotatingDrawable(super.getIconDrawable());
mRotatingDrawable = rotatingDrawable;
final OvershootInterpolator interpolator = new OvershootInterpolator();
final ObjectAnimator collapseAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", EXPANDED_PLUS_ROTATION, COLLAPSED_PLUS_ROTATION);
final ObjectAnimator expandAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", COLLAPSED_PLUS_ROTATION, EXPANDED_PLUS_ROTATION);
collapseAnimator.setInterpolator(interpolator);
expandAnimator.setInterpolator(interpolator);
mExpandAnimation.play(expandAnimator);
mCollapseAnimation.play(collapseAnimator);
return rotatingDrawable;
}
};
mAddButton.setId(R.id.fab_expand_menu_button);
mAddButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
toggle();
}
});
addView(mAddButton, super.generateDefaultLayoutParams());
}
use of android.view.animation.OvershootInterpolator in project UltimateAndroid by cymcsg.
the class RayLayout method bindChildAnimation.
private void bindChildAnimation(final View child, final int index, final long duration) {
final boolean expanded = mExpanded;
final int childCount = getChildCount();
Rect frame = computeChildFrame(!expanded, mLeftHolderWidth, index, mChildGap, mChildSize);
final int toXDelta = frame.left - child.getLeft();
final int toYDelta = frame.top - child.getTop();
Interpolator interpolator = mExpanded ? new AccelerateInterpolator() : new OvershootInterpolator(1.5f);
final long startOffset = computeStartOffset(childCount, mExpanded, index, 0.1f, duration, interpolator);
Animation animation = mExpanded ? createShrinkAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator) : createExpandAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator);
final boolean isLast = getTransformedIndex(expanded, childCount, index) == childCount - 1;
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (isLast) {
postDelayed(new Runnable() {
@Override
public void run() {
onAllAnimationsEnd();
}
}, 0);
}
}
});
child.setAnimation(animation);
}
Aggregations