use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.
the class NavigationHeaderLayout method beginAvatarTransition.
private void beginAvatarTransition(ImageView moveAvatarOneImage, ImageView moveAvatarTwoImage, ImageView moveAvatarThreeImage) {
ImageView appearAvatarImage = moveAvatarOneImage;
ImageView disappearAvatarImage = moveAvatarThreeImage != null ? moveAvatarThreeImage : moveAvatarTwoImage;
ImageView fadeOutDisappearAvatarImage = disappearAvatarImage == mAvatarImage ? mFadeOutAvatarImage : disappearAvatarImage == mRecentOneAvatarImage ? mFadeOutRecentOneAvatarImage : mFadeOutRecentTwoAvatarImage;
TransitionSet transitionSet = new TransitionSet();
int duration = ViewUtils.getLongAnimTime(getContext());
// Will be set on already added and newly added transitions.
transitionSet.setDuration(duration);
// NOTE: TransitionSet.setInterpolator() won't have any effect on platform versions.
// https://code.google.com/p/android/issues/detail?id=195495
transitionSet.setInterpolator(new FastOutSlowInInterpolator());
Fade fadeOutAvatar = new Fade(Fade.OUT);
setAvatarImageFrom(fadeOutDisappearAvatarImage, disappearAvatarImage);
fadeOutDisappearAvatarImage.setVisibility(VISIBLE);
fadeOutAvatar.addTarget(fadeOutDisappearAvatarImage);
transitionSet.addTransition(fadeOutAvatar);
// Make it finish before new avatar arrives.
fadeOutAvatar.setDuration(duration / 2);
Fade fadeInAvatar = new Fade(Fade.IN);
appearAvatarImage.setVisibility(INVISIBLE);
fadeInAvatar.addTarget(appearAvatarImage);
transitionSet.addTransition(fadeInAvatar);
ChangeTransform changeAppearAvatarTransform = new ChangeTransform();
appearAvatarImage.setScaleX(0.8f);
appearAvatarImage.setScaleY(0.8f);
changeAppearAvatarTransform.addTarget(appearAvatarImage);
transitionSet.addTransition(changeAppearAvatarTransform);
addChangeMoveToAvatarTransformToTransitionSet(moveAvatarOneImage, moveAvatarTwoImage, transitionSet);
if (moveAvatarThreeImage != null) {
addChangeMoveToAvatarTransformToTransitionSet(moveAvatarTwoImage, moveAvatarThreeImage, transitionSet);
}
CrossfadeText crossfadeText = new CrossfadeText();
crossfadeText.addTarget(mNameText);
crossfadeText.addTarget(mDescriptionText);
transitionSet.addTransition(crossfadeText);
transitionSet.addListener(new Transition.TransitionListenerAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
mAccountTransitionRunning = false;
mInfoLayout.setEnabled(true);
if (mListener != null) {
mListener.onAccountTransitionEnd();
}
}
});
mInfoLayout.setEnabled(false);
TransitionManager.beginDelayedTransition(this, transitionSet);
mAccountTransitionRunning = true;
if (mListener != null) {
mListener.onAccountTransitionStart();
}
fadeOutDisappearAvatarImage.setVisibility(INVISIBLE);
appearAvatarImage.setVisibility(VISIBLE);
appearAvatarImage.setScaleX(1);
appearAvatarImage.setScaleY(1);
resetMoveToAvatarTransform(moveAvatarTwoImage);
if (moveAvatarThreeImage != null) {
resetMoveToAvatarTransform(moveAvatarThreeImage);
}
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.
the class ShapeReveal method start.
@Override
public void start(@Nullable final IEndListener listener) {
text.setAlpha(255);
animator = revealShape.getAnimator();
animator.setInterpolator(new FastOutSlowInInterpolator());
Utils.addEndListener(this, animator, new IEndListener() {
@Override
public void onAnimationEnd(ISurfaceAnimation animation) {
text.removeEffect(ShapeReveal.this);
if (hideOnEnd)
text.setAlpha(0);
if (listener != null)
listener.onAnimationEnd(ShapeReveal.this);
}
});
animator.setDuration(duration);
animator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.
the class Slide method start.
@Override
public void start(@Nullable final IEndListener listener) {
text.setAlpha(255);
PropertyValuesHolder hHolder = null;
PropertyValuesHolder vHolder = null;
float fromX = 0;
float toX = 0;
float fromY = 0;
float toY = 0;
if ((side & Side.LEFT) == side) {
if (toShow) {
fromX = -text.getWidth();
} else {
toX = -text.getWidth();
}
hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
} else if ((side & Side.RIGHT) == side) {
if (toShow) {
fromX = text.getWidth();
} else {
toX = text.getWidth();
}
hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
}
if ((side & Side.TOP) == side) {
if (toShow) {
fromY = -text.getHeight();
} else {
toY = -text.getHeight();
}
vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
} else if ((side & Side.BOTTOM) == side) {
if (toShow) {
fromY = text.getHeight();
} else {
toY = text.getHeight();
}
vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
}
if (hHolder != null && vHolder != null) {
animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder, vHolder);
} else if (hHolder != null) {
animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder);
} else {
animator = ObjectAnimator.ofPropertyValuesHolder(this, vHolder);
}
animator.setInterpolator(new FastOutSlowInInterpolator());
Utils.addEndListener(this, animator, new IEndListener() {
@Override
public void onAnimationEnd(ISurfaceAnimation animation) {
text.removeEffect(Slide.this);
if (!toShow)
text.setAlpha(0);
if (listener != null)
listener.onAnimationEnd(Slide.this);
}
});
animator.setDuration(duration);
animator.addUpdateListener(this);
animator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.
the class TransSurface method start.
@Override
public void start(@Nullable final IEndListener listener) {
float fromX = camera.getTransX();
float fromY = camera.getTransY();
float toX;
float toY;
if (textPivot == null) {
toX = camera.getTransX() + dx;
toY = camera.getTransY() + dy;
} else {
toX = textPivot.getPosition().getRelativeX(pivot, textPivot, true) * camera.getScale() * -1;
toY = textPivot.getPosition().getRelativeY(pivot, textPivot, true) * camera.getScale() * -1;
}
debugTranslation(fromX, fromY, toX, toY);
PropertyValuesHolder dxHolder = PropertyValuesHolder.ofFloat("transX", fromX, toX);
PropertyValuesHolder dyHolder = PropertyValuesHolder.ofFloat("transY", fromY, toY);
animator = ObjectAnimator.ofPropertyValuesHolder(camera, dxHolder, dyHolder);
animator.setInterpolator(new FastOutSlowInInterpolator());
Utils.addEndListener(this, animator, listener);
animator.setDuration(duration);
animator.addUpdateListener(this);
animator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Carbon by ZieIony.
the class PathAnimationActivity method onCreate.
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initToolbar();
ImageView imageView = findViewById(R.id.image);
imageView.setImageDrawable(new DrawableImageGenerator(this).next());
LinearLayout card = findViewById(R.id.card);
View layout = findViewById(R.id.layout);
layout.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
NURBS nurbs = new NURBS();
nurbs.addPoint(new PointF(card.getX() + card.getWidth() / 2, card.getY() + card.getHeight() / 2));
nurbs.addPoint(new PointF(event.getX(), card.getY() + card.getHeight() / 2));
nurbs.addPoint(new PointF(event.getX(), event.getY()));
nurbs.init();
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
float srcWidth = card.getWidth();
float srcHeight = card.getHeight();
float destWidth = expanded ? getResources().getDimension(R.dimen.carbon_contentSpace) : layout.getWidth();
float destHeight = destWidth * 9.0f / 16;
animator.setDuration(500);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.addUpdateListener(animation -> {
PointF point = nurbs.getPoint((Float) animation.getAnimatedValue());
int w = (int) MathUtils.lerp(srcWidth, destWidth, (Float) animation.getAnimatedValue());
int h = (int) MathUtils.lerp(srcHeight, destHeight, (Float) animation.getAnimatedValue());
int x = (int) point.x - w / 2;
int y = (int) point.y - h / 2;
card.setBounds(x, y, w, h);
});
animator.start();
expanded = !expanded;
}
return true;
});
}
Aggregations