use of android.view.animation.DecelerateInterpolator in project PhotoNoter by yydcdut.
the class FeedbackActivity method startSendingAnimation.
private void startSendingAnimation(final RevealView.RevealAnimationListener listener) {
final int width = mFab.getLeft();
final int height = mFab.getTop();
ValueAnimator valueAnimator = new ValueAnimator();
valueAnimator.setDuration(Const.DURATION / 2);
valueAnimator.setObjectValues(new PointF(0, 0));
valueAnimator.setInterpolator(new DecelerateInterpolator());
valueAnimator.setEvaluator(new TypeEvaluator<PointF>() {
@Override
public PointF evaluate(float fraction, PointF startValue, PointF endValue) {
PointF point = new PointF();
point.x = (width) * (1 - fraction / 2);
point.y = (height) - 0.85f * (height) * (fraction / 2) * (fraction / 2);
return point;
}
});
valueAnimator.start();
valueAnimator.addUpdateListener((animation) -> {
PointF point = (PointF) animation.getAnimatedValue();
mFab.setX(point.x);
mFab.setY(point.y);
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mRevealView.reveal((int) mFab.getX() + mFab.getWidth() / 2, (int) mFab.getY() + mFab.getHeight() / 2, getThemeColor(), Const.RADIUS, Const.DURATION, listener);
}
});
}
use of android.view.animation.DecelerateInterpolator in project PhotoNoter by yydcdut.
the class DetailActivity method initAnimationView.
@Override
public void initAnimationView() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(mCardView, "translationY", 0, mTranslateHeight));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mOverlayView.setVisibility(View.GONE);
mIsIgnoreClick = true;
}
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
mIsIgnoreClick = true;
}
});
animatorSet.setDuration(400);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.start();
mAnimationHandler.postDelayed(mDownDelayRunnable, 350);
}
}, 500);
}
use of android.view.animation.DecelerateInterpolator in project WordPress-Android by wordpress-mobile.
the class AniUtils method animateBar.
private static void animateBar(View view, boolean show, boolean isTopBar, Duration duration) {
int newVisibility = (show ? View.VISIBLE : View.GONE);
if (view == null || view.getVisibility() == newVisibility) {
return;
}
float fromY;
float toY;
if (isTopBar) {
fromY = (show ? -1f : 0f);
toY = (show ? 0f : -1f);
} else {
fromY = (show ? 1f : 0f);
toY = (show ? 0f : 1f);
}
Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, fromY, Animation.RELATIVE_TO_SELF, toY);
long durationMillis = duration.toMillis(view.getContext());
animation.setDuration(durationMillis);
if (show) {
animation.setInterpolator(new DecelerateInterpolator());
} else {
animation.setInterpolator(new AccelerateInterpolator());
}
view.clearAnimation();
view.startAnimation(animation);
view.setVisibility(newVisibility);
}
use of android.view.animation.DecelerateInterpolator in project WordPress-Android by wordpress-mobile.
the class AniUtils method showFab.
/*
* in/out animation for floating action button
*/
public static void showFab(final View view, final boolean show) {
if (view == null)
return;
Context context = view.getContext();
int fabHeight = context.getResources().getDimensionPixelSize(android.support.design.R.dimen.design_fab_size_normal);
int fabMargin = context.getResources().getDimensionPixelSize(R.dimen.fab_margin);
int max = (fabHeight + fabMargin) * 2;
float fromY = (show ? max : 0f);
float toY = (show ? 0f : max);
ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, fromY, toY);
if (show) {
anim.setInterpolator(new DecelerateInterpolator());
} else {
anim.setInterpolator(new AccelerateInterpolator());
}
anim.setDuration(show ? Duration.LONG.toMillis(context) : Duration.SHORT.toMillis(context));
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (view.getVisibility() != View.VISIBLE) {
view.setVisibility(View.VISIBLE);
}
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (!show) {
view.setVisibility(View.GONE);
}
}
});
anim.start();
}
use of android.view.animation.DecelerateInterpolator in project JamsMusicPlayer by psaravan.
the class QueueDrawerFragment method animatePauseToPlay.
/**
* Animates the pause button to a play button.
*/
private void animatePauseToPlay() {
//Check to make sure the current icon is the pause icon.
if (mPlayPauseButton.getId() != R.drawable.pause_light)
return;
//Scale out the pause button.
final ScaleAnimation scaleOut = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
scaleOut.setDuration(150);
scaleOut.setInterpolator(new AccelerateInterpolator());
//Scale in the play button.
final ScaleAnimation scaleIn = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
scaleIn.setDuration(150);
scaleIn.setInterpolator(new DecelerateInterpolator());
scaleOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mPlayPauseButton.setImageResource(R.drawable.play_light);
mPlayPauseButton.setPadding(0, 0, -5, 0);
mPlayPauseButton.startAnimation(scaleIn);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
scaleIn.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mPlayPauseButton.setScaleX(1.0f);
mPlayPauseButton.setScaleY(1.0f);
mPlayPauseButton.setId(R.drawable.play_light);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
mPlayPauseButton.startAnimation(scaleOut);
}
Aggregations