use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Phonograph by kabouzeid.
the class FlatPlayerPlaybackControlsFragment method show.
public void show() {
if (hidden) {
if (musicControllerAnimationSet == null) {
TimeInterpolator interpolator = new FastOutSlowInInterpolator();
final int duration = 300;
LinkedList<Animator> animators = new LinkedList<>();
addAnimation(animators, playPauseButton, interpolator, duration, 0);
addAnimation(animators, nextButton, interpolator, duration, 100);
addAnimation(animators, prevButton, interpolator, duration, 100);
addAnimation(animators, shuffleButton, interpolator, duration, 200);
addAnimation(animators, repeatButton, interpolator, duration, 200);
musicControllerAnimationSet = new AnimatorSet();
musicControllerAnimationSet.playTogether(animators);
} else {
musicControllerAnimationSet.cancel();
}
musicControllerAnimationSet.start();
}
hidden = false;
}
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();
}
Aggregations