use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.
the class Rotate3D method start.
@Override
public void start(@Nullable final IEndListener listener) {
PropertyValuesHolder valHolder = null;
int fromDegree;
int toDegree;
text.setAlpha(255);
if (show) {
fromDegree = 90;
toDegree = 0;
} else {
fromDegree = 0;
toDegree = -90;
}
if ((pivot & Pivot.BOTTOM) == Pivot.BOTTOM) {
valHolder = PropertyValuesHolder.ofFloat("rotationX", fromDegree, toDegree);
cameraTransXPre = -text.getWidth() / 2;
cameraTransXPost = text.getWidth() / 2;
cameraTransYPre = -text.getFontDescent();
cameraTransYPost = 0;
} else if ((pivot & Pivot.TOP) == Pivot.TOP) {
valHolder = PropertyValuesHolder.ofFloat("rotationX", -fromDegree, toDegree);
cameraTransXPre = -text.getWidth() / 2;
cameraTransXPost = text.getWidth() / 2;
cameraTransYPre = text.getHeight() - text.getFontDescent();
cameraTransYPost = -text.getHeight();
}
if ((pivot & Pivot.LEFT) == Pivot.LEFT) {
valHolder = PropertyValuesHolder.ofFloat("rotationY", fromDegree, toDegree);
cameraTransXPre = 0;
cameraTransXPost = 0;
cameraTransYPre = text.getHeight() / 2 - text.getFontDescent();
cameraTransYPost = text.getHeight() / 2 - text.getHeight();
} else if ((pivot & Pivot.RIGHT) == Pivot.RIGHT) {
valHolder = PropertyValuesHolder.ofFloat("rotationY", -fromDegree, toDegree);
cameraTransXPre = -text.getWidth();
cameraTransXPost = text.getWidth();
cameraTransYPre = text.getHeight() / 2 - text.getFontDescent();
cameraTransYPost = text.getHeight() / 2 - text.getHeight();
}
if ((pivot & Pivot.CENTER) == Pivot.CENTER) {
valHolder = PropertyValuesHolder.ofFloat(axis == Axis.Y ? "rotationY" : "rotationX", fromDegree, toDegree);
cameraTransXPre = -text.getWidth() / 2;
cameraTransXPost = text.getWidth() / 2;
cameraTransYPre = text.getHeight() / 2 - text.getFontDescent();
cameraTransYPost = text.getHeight() / 2 - text.getHeight();
}
if (valHolder != null) {
animator = ObjectAnimator.ofPropertyValuesHolder(this, valHolder);
animator.setInterpolator(new FastOutSlowInInterpolator());
Utils.addEndListener(this, animator, new IEndListener() {
@Override
public void onAnimationEnd(ISurfaceAnimation animation) {
text.removeEffect(Rotate3D.this);
if (!show)
text.setAlpha(0);
if (listener != null)
listener.onAnimationEnd(Rotate3D.this);
}
});
animator.setDuration(duration);
animator.addUpdateListener(this);
animator.start();
} else {
throw new RuntimeException(getClass().getSuperclass() + " was not configured properly. Pivot:" + pivot);
}
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.
the class ScaleSurface method start.
@Override
public void start(@Nullable IEndListener listener) {
float pivotX;
float pivotY;
if (fit == -1) {
pivotX = textPivot.getPosition().getRelativeX(pivot, textPivot, true);
pivotY = textPivot.getPosition().getRelativeY(pivot, textPivot, true);
} else {
int surfaceWidth = textSurface.getWidth();
float textWidth = textPivot.getWidth();
toScale = surfaceWidth / textWidth;
pivotX = textPivot.getPosition().getRelativeX(Pivot.CENTER, textPivot, true);
pivotY = textPivot.getPosition().getRelativeY(Pivot.CENTER, textPivot, true);
}
PropertyValuesHolder scaleHolder = PropertyValuesHolder.ofFloat("scale", camera.getScale(), toScale);
PropertyValuesHolder pivotXHolder = PropertyValuesHolder.ofFloat("scalePivotX", camera.getScalePivotX(), pivotX);
PropertyValuesHolder pivotYHolder = PropertyValuesHolder.ofFloat("scalePivotY", camera.getScalePivotY(), pivotY);
animator = ObjectAnimator.ofPropertyValuesHolder(camera, scaleHolder, pivotXHolder, pivotYHolder);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(duration);
animator.addUpdateListener(this);
Utils.addEndListener(this, animator, listener);
animator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.
the class TransparentDoubleClickToolbar method animateToTransparent.
public void animateToTransparent(boolean transparent) {
if (mTransparent == transparent) {
return;
}
mTransparent = transparent;
if (mAnimator != null) {
mAnimator.cancel();
mAnimator = null;
}
mAnimator = ValueAnimator.ofInt(mAlpha, mTransparent ? 0 : 255).setDuration(mAnimationDuration);
mAnimator.setInterpolator(new FastOutSlowInInterpolator());
mAnimator.addUpdateListener(animation -> {
int alpha = (int) animation.getAnimatedValue();
setToolbarAlpha(alpha);
});
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
mAnimator = null;
}
@Override
public void onAnimationEnd(Animator animation) {
mAnimator = null;
}
});
mAnimator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.
the class FriendlyFloatingActionButton method show.
public void show() {
if (mShowing) {
return;
}
mShowing = true;
cancelAnimator();
mAnimator = ObjectAnimator.ofFloat(this, TRANSLATION_Y, getTranslationY(), 0).setDuration(mAnimationDuration);
mAnimator.setInterpolator(new FastOutSlowInInterpolator());
mAnimator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.
the class FlexibleSpaceLayout method animateHeaderViewScroll.
public void animateHeaderViewScroll(boolean toCollapsed) {
ObjectAnimator animator = ObjectAnimator.ofInt(this, SCROLL, mScroll, toCollapsed ? mHeaderView.getScrollExtent() : 0);
animator.setDuration(mMediumAnimationTime);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.start();
}
Aggregations