Java 类android.view.animation.AccelerateDecelerateInterpolator 实例源码
项目:ChromeLikeTabSwitcher
文件:PhoneTabSwitcherLayout.java
/**
* Animates a tab to be swiped horizontally.
*
* @param tabItem
* The tab item, which corresponds to the tab, which should be swiped, as an instance of
* the class {@link TabItem}. The tab item may not be null
* @param targetPosition
* The position on the x-axis, the tab should be moved to, in pixels as a {@link Float}
* value
* @param selected
* True, if the tab should become the selected one, false otherwise
* @param animationDuration
* The duration of the animation in milliseconds as a {@link Long} value
* @param velocity
* The velocity of the drag gesture, which caused the tab to be swiped, in pixels per
* second as a {@link Float} value
*/
private void animateSwipe(@NonNull final TabItem tabItem, final float targetPosition,
final boolean selected, final long animationDuration,
final float velocity) {
View view = tabItem.getView();
float currentPosition = getArithmetics().getPosition(Axis.X_AXIS, tabItem);
float distance = Math.abs(targetPosition - currentPosition);
float maxDistance = getArithmetics().getSize(Axis.X_AXIS, tabItem) + swipedTabDistance;
long duration = velocity > 0 ? Math.round((distance / velocity) * 1000) :
Math.round(animationDuration * (distance / maxDistance));
ViewPropertyAnimator animation = view.animate();
animation.setListener(new AnimationListenerWrapper(
selected ? createSwipeSelectedTabAnimationListener(tabItem) :
createSwipeNeighborAnimationListener(tabItem)));
animation.setInterpolator(new AccelerateDecelerateInterpolator());
animation.setDuration(duration);
animation.setStartDelay(0);
getArithmetics().animatePosition(Axis.X_AXIS, animation, tabItem, targetPosition, true);
animation.start();
}
项目:Pocket-Plays-for-Twitch
文件:AnimationService.java
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
final int ANIMATION_DURATION = 650;
final int BASE_DELAY = 50;
TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);
AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
final AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(translationAnimation);
animationSet.addAnimation(alphaAnimation);
animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.setFillAfter(true);
animationSet.setFillBefore(true);
animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);
aCard.setAnimation(animationSet);
}
项目:NeoTerm
文件:PhoneTabSwitcherLayout.java
/**
* Starts a reveal animation to add a specific tab.
*
* @param tabItem
* The tab item, which corresponds to the tab, which should be added, as an instance of
* the class {@link TabItem}. The tab item may not be null
* @param revealAnimation
* The reveal animation, which should be started, as an instance of the class {@link
* RevealAnimation}. The reveal animation may not be null
*/
private void animateReveal(@NonNull final TabItem tabItem,
@NonNull final RevealAnimation revealAnimation) {
tabViewBottomMargin = -1;
recyclerAdapter.clearCachedPreviews();
dragHandler.setCallback(null);
View view = tabItem.getView();
ViewPropertyAnimator animation = view.animate();
animation.setInterpolator(
revealAnimation.getInterpolator() != null ? revealAnimation.getInterpolator() :
new AccelerateDecelerateInterpolator());
animation.setListener(new AnimationListenerWrapper(createHideSwitcherAnimationListener()));
animation.setStartDelay(0);
animation.setDuration(revealAnimation.getDuration() != -1 ? revealAnimation.getDuration() :
revealAnimationDuration);
getArithmetics().animateScale(Axis.DRAGGING_AXIS, animation, 1);
getArithmetics().animateScale(Axis.ORTHOGONAL_AXIS, animation, 1);
animation.start();
animateToolbarVisibility(getModel().areToolbarsShown() && getModel().isEmpty(), 0);
}
项目:GitHub
文件:RoundProgressView.java
private void init() {
mPath = new Paint();
mPantR = new Paint();
mPantR.setColor(Color.WHITE);
mPantR.setAntiAlias(true);
mPath.setAntiAlias(true);
mPath.setColor(Color.rgb(114, 114, 114));
va = ValueAnimator.ofInt(0,360);
va.setDuration(720);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
endAngle = (int) animation.getAnimatedValue();
postInvalidate();
}
});
va.setRepeatCount(ValueAnimator.INFINITE);
va.setInterpolator(new AccelerateDecelerateInterpolator());
}
项目:GitHub
文件:PullLoadMoreRecyclerView.java
public void loadMore() {
if (mPullLoadMoreListener != null && hasMore) {
mFooterView.animate()
.translationY(0)
.setDuration(300)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mFooterView.setVisibility(View.VISIBLE);
}
})
.start();
invalidate();
mPullLoadMoreListener.onLoadMore();
}
}
项目:GitHub
文件:RoundProgressView.java
private void initView() {
mPath = new Paint();
mPantR = new Paint();
mPath.setAntiAlias(true);
mPantR.setAntiAlias(true);
mPath.setColor(Color.WHITE);
mPantR.setColor(0x55000000);
DensityUtil density = new DensityUtil();
mRadius = density.dip2px(20);
mOutsideCircle = density.dip2px(7);
mPath.setStrokeWidth(density.dip2px(3));
mPantR.setStrokeWidth(density.dip2px(3));
mAnimator = ValueAnimator.ofInt(0,360);
mAnimator.setDuration(720);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
项目:Xndroid
文件:AnimationUtils.java
/**
* Creates an animation that rotates an {@link ImageView}
* around the Y axis by 180 degrees and changes the image
* resource shown when the view is rotated 90 degrees to the user.
*
* @param imageView the view to rotate.
* @param drawableRes the drawable to set when the view
* is rotated by 90 degrees.
* @return an animation that will change the image shown by the view.
*/
@NonNull
public static Animation createRotationTransitionAnimation(@NonNull final ImageView imageView,
@DrawableRes final int drawableRes) {
Animation animation = new Animation() {
private boolean mSetFinalDrawable;
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime < 0.5f) {
imageView.setRotationY(90 * interpolatedTime * 2f);
} else {
if (!mSetFinalDrawable) {
mSetFinalDrawable = true;
imageView.setImageResource(drawableRes);
}
imageView.setRotationY((-90) + (90 * (interpolatedTime - 0.5f) * 2f));
}
}
};
animation.setDuration(300);
animation.setInterpolator(new AccelerateDecelerateInterpolator());
return animation;
}
项目:BubblePagerIndicator
文件:BubblePageIndicator.java
private void animateShifting(final int from, final int to) {
if (translationAnim != null && translationAnim.isRunning()) translationAnim.end();
translationAnim = ValueAnimator.ofInt(from, to);
translationAnim.setDuration(ANIMATION_TIME);
translationAnim.setInterpolator(new AccelerateDecelerateInterpolator());
translationAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int val = (Integer) valueAnimator.getAnimatedValue();
offset = (val - to) * 1f / (from - to);
startX = val;
invalidate();
}
});
translationAnim.addListener(new AnimatorListener() {
@Override
public void onAnimationEnd(Animator animator) {
animationState = ANIMATE_IDLE;
startX = to;
offset = 0;
invalidate();
}
});
translationAnim.start();
}
项目:fingerblox
文件:ScannerOverlayView.java
private void initAnimation() {
paint.setStrokeWidth(getHeight() * 0.01f);
paint.setAntiAlias(true);
paint.setDither(true);
paint.setColor(Color.argb(248, 255, 255, 255));
paint.setStrokeWidth(20f);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeCap(Paint.Cap.ROUND);
paintGlow.set(paint);
paintGlow.setColor(Color.argb(235, 74, 138, 255));
paintGlow.setStrokeWidth(30f);
paintGlow.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.NORMAL));
float deltaY = (CameraOverlayView.PADDING * 2) * getHeight();
Log.i(TAG, String.format("Delta Y : %s", deltaY));
TranslateAnimation mAnimation = new TranslateAnimation(0f, 0f, 0f, deltaY);
mAnimation.setDuration(3000);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
setAnimation(mAnimation);
}
项目:Nibo
文件:ViewAnimationUtils.java
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){
view.setRotationX(baseRotation);
view.setTranslationY(fromY);
view
.animate()
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
项目:Rxjava2.0Demo
文件:RoundProgressView.java
private void initView() {
mPath = new Paint();
mPantR = new Paint();
mPath.setAntiAlias(true);
mPantR.setAntiAlias(true);
mPath.setColor(Color.WHITE);
mPantR.setColor(0x55000000);
DensityUtil density = new DensityUtil();
mRadius = density.dip2px(20);
mOutsideCircle = density.dip2px(7);
mPath.setStrokeWidth(density.dip2px(3));
mPantR.setStrokeWidth(density.dip2px(3));
mAnimator = ValueAnimator.ofInt(0,360);
mAnimator.setDuration(720);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
项目:SunmiUI
文件:CustomSharedTransitionActivity.java
private void performCircularReveal() {
show.setBackgroundColor(0xffff0000);
ViewCompat.setTranslationY(show, 0);
ViewCompat.setTranslationX(show, 0);
show.getLayoutParams().height = 500;
show.getLayoutParams().width = 1920;
show.requestLayout();
int centerX = (show.getLeft() + show.getRight()) / 2;
int centerY = (show.getTop() + show.getBottom()) / 2;
float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
show, centerX, centerY, 0, finalRadius);
mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
mCircularReveal.setDuration(500);
mCircularReveal.start();
}
项目:ChromeLikeTabSwitcher
文件:PhoneTabSwitcherLayout.java
/**
* Creates and returns a layout listener, which allows to start a peek animation to add a tab,
* once its view has been inflated.
*
* @param item
* The item, which corresponds to the tab, which should be added, as an instance of the
* class {@link AbstractItem}. The item may not be null
* @param peekAnimation
* The peek animation, which should be started, as an instance of the class {@link
* PeekAnimation}. The peek animation may not be null
* @return The listener, which has been created, as an instance of the type {@link
* OnGlobalLayoutListener}. The listener may not be null
*/
private OnGlobalLayoutListener createPeekLayoutListener(@NonNull final AbstractItem item,
@NonNull final PeekAnimation peekAnimation) {
return new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
long totalDuration =
peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() :
peekAnimationDuration;
long duration = totalDuration / 3;
Interpolator interpolator =
peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() :
new AccelerateDecelerateInterpolator();
float peekPosition =
getArithmetics().getTabContainerSize(Axis.DRAGGING_AXIS, false) * 0.66f;
animatePeek(item, duration, interpolator, peekPosition, peekAnimation);
}
};
}
项目:AnimationShowcase
文件:ObjectAnimatorActivity.java
@OnClick(R.id.translateAndFade)
public void onTranslateAndFade() {
ValueAnimator xAnimator = ObjectAnimator.ofFloat(icon, "translationX", icon.getTranslationX(), animateForward ? icon.getWidth() * 2 : 0.0f);
ValueAnimator yAnimator = ObjectAnimator.ofFloat(icon, "translationY", icon.getTranslationY(), animateForward ? icon.getHeight() * 4 : 0.0f);
ValueAnimator alphaAnimator = ObjectAnimator.ofFloat(icon, "alpha", icon.getAlpha(), animateForward ? 0.0f : 1.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(FULL_ANIMATION_DURATION);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.playTogether(xAnimator, yAnimator, alphaAnimator);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
System.out.println("translateAndFade END");
}
});
animatorSet.start();
animateForward = !animateForward;
}
项目:react-native-android-circular-reveal
文件:CircularRevealLayout.java
public void reveal (float positionFromRight, int animationDuration) {
View revealingView = circularRevealViewContainer.getChildAt(0);
// start x-index for circular animation
int cx = revealingView.getWidth() - (int) (positionFromRight);
// start y-index for circular animation
int cy = (revealingView.getTop() + revealingView.getBottom()) / 2;
// calculate max radius
int dx = Math.max(cx, revealingView.getWidth() - cx);
int dy = Math.max(cy, revealingView.getHeight() - cy);
float finalRadius = (float) Math.hypot(dx, dy);
// Circular animation declaration begin
final Animator animator;
animator = io.codetail.animation.ViewAnimationUtils
.createCircularReveal(revealingView, cx, cy, 0, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(animationDuration);
revealingView.setVisibility(View.VISIBLE);
animator.start();
}
项目:react-native-android-circular-reveal
文件:CircularRevealLayout.java
public void hide (float positionFromRight, int animationDuration) {
View revealingView = circularRevealViewContainer.getChildAt(0);
int cx = revealingView.getWidth() - (int) (positionFromRight);
int cy = (revealingView.getTop() + revealingView.getBottom()) / 2;
int dx = Math.max(cx, revealingView.getWidth() - cx);
int dy = Math.max(cy, revealingView.getHeight() - cy);
float finalRadius = (float) Math.hypot(dx, dy);
Animator animator;
animator = io.codetail.animation.ViewAnimationUtils
.createCircularReveal(revealingView, cx, cy, finalRadius, 0);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(animationDuration);
revealingView.setVisibility(View.GONE);
animator.start();
}
项目:AndroidSkinAnimator
文件:SkinRotateAnimator3.java
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
this.targetView = view;
preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
PropertyValuesHolder.ofFloat("scaleX",
1, 0.5f, 0.2f, 0.05f, 0.8f, 1),
PropertyValuesHolder.ofFloat("scaleY",
1, 0.5f, 0.2f, 0.05f, 0.8f, 1),
PropertyValuesHolder.ofFloat("rotationY", 0, 720))
.setDuration(PRE_DURATION * 3);
preAnimator.setInterpolator(new LinearInterpolator());
view.postDelayed(new Runnable() {
@Override
public void run() {
if(action != null){
action.action();
}
}
}, PRE_DURATION);
preAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
return this;
}
项目:Pocket-Plays-for-Twitch
文件:UpdateDialogHandler.java
private void circularDismissView(final View view) {
final int DURATION = 600;
// Get the center for the FAB
int cx = (int) view.getX() + view.getMeasuredHeight() / 2;
int cy = (int) view.getY() + view.getMeasuredWidth() / 2;
// get the final radius for the clipping circle
int dx = Math.max(cx, view.getWidth() - cx);
int dy = Math.max(cy, view.getHeight() - cy);
float finalRadius = (float) Math.hypot(dx, dy);
final SupportAnimator dismissAnimation = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius).reverse();
dismissAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
dismissAnimation.setDuration(DURATION);
dismissAnimation.start();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mSuperContainer.setVisibility(View.GONE);
}
}, DURATION);
}
项目:Slide-RSS
文件:MainActivity.java
/**
* Starts the enter animations for various UI components of the toolbar subreddit search
*
* @param ANIMATION_DURATION duration of the animation in ms
* @param SUGGESTIONS_BACKGROUND background of subreddit suggestions list
* @param GO_TO_SUB_FIELD search field in toolbar
* @param CLOSE_BUTTON button that clears the search and closes the search UI
*/
public void enterAnimationsForToolbarSearch(final long ANIMATION_DURATION,
final CardView SUGGESTIONS_BACKGROUND, final AutoCompleteTextView GO_TO_SUB_FIELD,
final ImageView CLOSE_BUTTON) {
SUGGESTIONS_BACKGROUND.animate()
.translationY(headerHeight)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(ANIMATION_DURATION + ANIMATE_DURATION_OFFSET)
.start();
GO_TO_SUB_FIELD.animate()
.alpha(1f)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(ANIMATION_DURATION)
.start();
CLOSE_BUTTON.animate()
.alpha(1f)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(ANIMATION_DURATION)
.start();
}
项目:AnimationShowcase
文件:ViewPropertyAnimatorActivity.java
@OnClick(R.id.adaptive_rotation)
public void onAdaptiveRotation() {
float targetRotation = animateForward
? 180.0f
: 0.0f;
float currentRotation = icon.getRotation();
float actualRotationDelta = Math.abs(targetRotation - currentRotation);
long duration = (long) (FULL_ANIMATION_DURATION * actualRotationDelta / 180.0f);
ViewPropertyAnimator animator = icon.animate();
if (duration < FULL_ANIMATION_DURATION / 2) {
animator.setInterpolator(new AccelerateInterpolator());
} else {
animator.setInterpolator(new AccelerateDecelerateInterpolator());
}
animator
.rotation(targetRotation)
.setDuration(duration);
animateForward = !animateForward;
}
项目:SmartRefreshLayout
文件:RoundProgressView.java
private void initView() {
mPath = new Paint();
mPantR = new Paint();
mPath.setAntiAlias(true);
mPantR.setAntiAlias(true);
mPath.setColor(Color.WHITE);
mPantR.setColor(0x55000000);
DensityUtil density = new DensityUtil();
mRadius = density.dip2px(20);
mOutsideCircle = density.dip2px(7);
mPath.setStrokeWidth(density.dip2px(3));
mPantR.setStrokeWidth(density.dip2px(3));
mAnimator = ValueAnimator.ofInt(0,360);
mAnimator.setDuration(720);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
项目:JewelryUI
文件:ViewAnimationUtils.java
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay) {
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, fromY);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
项目:JewelryUI
文件:ViewAnimationUtils.java
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay) {
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
项目:SmartRefresh
文件:RoundProgressView.java
private void initView() {
mPath = new Paint();
mPantR = new Paint();
mPath.setAntiAlias(true);
mPantR.setAntiAlias(true);
mPath.setColor(Color.WHITE);
mPantR.setColor(0x55000000);
DensityUtil density = new DensityUtil();
mRadius = density.dip2px(20);
mOutsideCircle = density.dip2px(7);
mPath.setStrokeWidth(density.dip2px(3));
mPantR.setStrokeWidth(density.dip2px(3));
mAnimator = ValueAnimator.ofInt(0,360);
mAnimator.setDuration(720);
mAnimator.addUpdateListener(animation -> {
endAngle = (int) animation.getAnimatedValue();
postInvalidate();
});
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
项目:Pocket-Plays-for-Twitch
文件:DonationActivity.java
private void showPromptText(TextView v) {
if (currentPrompt == 2) {
v.setText(getString(R.string.donation_prompt_three));
} else if (currentPrompt == PAYMENT_STEP) {
v.setText(getString(R.string.donation_prompt_four));
} else if (currentPrompt > PAYMENT_STEP) {
if (donationStep == 0) {
v.setText(getString(R.string.donation_prompt_nothing));
} else {
v.setText(getString(R.string.donation_prompt_donated));
}
}
Interpolator interpolator = new AccelerateDecelerateInterpolator();
v.setTranslationY((v.getHeight()));
v.animate().alpha(1f).translationY(0).setDuration(animationDuration).setInterpolator(interpolator).start();
}
项目:ModesoActionOverlay-Android
文件:ProfileAnimatedMenu.java
void animateMenuItemOpen(View view,long delay){
ObjectAnimator animScaleX = ObjectAnimator.ofFloat(view,"scaleX",0.0f,1.0f);
ObjectAnimator animScaleY = ObjectAnimator.ofFloat(view,"scaleY",0.0f,1.0f);
ObjectAnimator animAlpha = ObjectAnimator.ofFloat(view,"alpha",0,ITEM_FINAL_ALPHA);
ObjectAnimator animRotation = ObjectAnimator.ofFloat(view,"rotation",0,360.0f);
final int X_SCALE_ANIMATION_DURATION = 300;
final int Y_SCALE_ANIMATION_DURATION = 300;
animScaleX.setDuration(X_SCALE_ANIMATION_DURATION);
animScaleY.setDuration(Y_SCALE_ANIMATION_DURATION);
animRotation.setDuration(200);
AnimatorSet animSet = new AnimatorSet();
if(allowItemRotationAnim)
animSet.playTogether(animScaleX,animScaleY,animAlpha,animRotation);
else
animSet.playTogether(animScaleX,animScaleY,animAlpha);
animSet.setStartDelay(delay);
animSet.setInterpolator(new AccelerateDecelerateInterpolator());
animSet.start();
}
项目:Mobike
文件:FlowerAnimation.java
public void a()
{
if ((this.b != null) && (this.b.isRunning()))
this.b.cancel();
this.b = ObjectAnimator.ofFloat(this, "phase1", new float[] { 0.0F, 1.0F });
this.b.setDuration(3 * this.k / 2);
this.b.addUpdateListener(this);
this.b.setInterpolator(new AccelerateInterpolator());
this.b.start();
if ((this.c != null) && (this.c.isRunning()))
this.c.cancel();
this.c = ObjectAnimator.ofFloat(this, "phase2", new float[] { 0.0F, 1.0F });
this.c.setDuration(2 * (this.k / 3));
this.c.addUpdateListener(this);
this.c.setStartDelay(2 * this.l);
this.c.start();
this.c.setInterpolator(new AccelerateDecelerateInterpolator());
if ((this.d != null) && (this.d.isRunning()))
this.d.cancel();
this.d = ObjectAnimator.ofFloat(this, "phase3", new float[] { 0.0F, 1.0F });
this.d.setDuration(this.k / 3);
this.d.addUpdateListener(this);
this.d.setInterpolator(new AccelerateInterpolator(2.0F));
this.d.setStartDelay(4 * this.l);
this.d.start();
}
项目:Pocket-Plays-for-Twitch
文件:AnimationService.java
public static void setActivityToolbarReset(Toolbar aMainToolbar, Toolbar aDecorativeToolbar, Activity aActivity, float fromToolbarPosition, float fromMainToolbarPosition) {
final int TOOLBAR_TRANSLATION_DURATION = 700;
float DECORATIVE_TOOLBAR_HEIGHT = -1 * aActivity.getResources().getDimension(R.dimen.additional_toolbar_height);
if(fromMainToolbarPosition == 0) {
DECORATIVE_TOOLBAR_HEIGHT += aActivity.getResources().getDimension(R.dimen.main_toolbar_height);
} else {
Animation moveMainToolbarAnimation = new TranslateAnimation(0, 0, fromMainToolbarPosition, 0);
moveMainToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveMainToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aMainToolbar.startAnimation(moveMainToolbarAnimation);
}
float fromTranslationY = (fromToolbarPosition < DECORATIVE_TOOLBAR_HEIGHT) ? DECORATIVE_TOOLBAR_HEIGHT : fromToolbarPosition;
Animation moveToolbarAnimation = new TranslateAnimation(0, 0, fromTranslationY, 0);
moveToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aDecorativeToolbar.startAnimation(moveToolbarAnimation);
}
项目:boohee_v5.6
文件:PieChartRotationAnimatorV8.java
public PieChartRotationAnimatorV8(PieChartView chart, long duration) {
this.interpolator = new AccelerateDecelerateInterpolator();
this.isAnimationStarted = false;
this.startRotation = 0.0f;
this.targetRotation = 0.0f;
this.animationListener = new DummyChartAnimationListener();
this.runnable = new Runnable() {
public void run() {
long elapsed = SystemClock.uptimeMillis() - PieChartRotationAnimatorV8.this.start;
if (elapsed > PieChartRotationAnimatorV8.this.duration) {
PieChartRotationAnimatorV8.this.isAnimationStarted = false;
PieChartRotationAnimatorV8.this.handler.removeCallbacks(PieChartRotationAnimatorV8.this.runnable);
PieChartRotationAnimatorV8.this.chart.setChartRotation((int) PieChartRotationAnimatorV8.this.targetRotation, false);
PieChartRotationAnimatorV8.this.animationListener.onAnimationFinished();
return;
}
PieChartRotationAnimatorV8.this.chart.setChartRotation((int) ((((PieChartRotationAnimatorV8.this.startRotation + ((PieChartRotationAnimatorV8.this.targetRotation - PieChartRotationAnimatorV8.this.startRotation) * Math.min(PieChartRotationAnimatorV8.this.interpolator.getInterpolation(((float) elapsed) / ((float) PieChartRotationAnimatorV8.this.duration)), 1.0f))) % 360.0f) + 360.0f) % 360.0f), false);
PieChartRotationAnimatorV8.this.handler.postDelayed(this, 16);
}
};
this.chart = chart;
this.duration = duration;
this.handler = new Handler();
}
项目:Pocket-Plays-for-Twitch
文件:DonationActivity.java
private void playInitAnimation() {
DisplayMetrics dm = getResources().getDisplayMetrics();
// Get the center for the FAB
int cx = dm.widthPixels / 2;
int cy = 0;
float finalRadius = dm.heightPixels;
revealTransition = ViewAnimationUtils.createCircularReveal(mainContentLayout, cx, cy, 0, finalRadius);
revealTransition.setInterpolator(new AccelerateDecelerateInterpolator());
revealTransition.setDuration(800);
revealTransition.addListener(new SupportAnimator.AnimatorListener() {
@Override
public void onAnimationStart() {
mainContentLayout.setVisibility(View.VISIBLE);
}
public void onAnimationEnd() {}
public void onAnimationCancel() {}
public void onAnimationRepeat() {}
});
revealTransition.start();
}
项目:FragmentRigger
文件:SharedTargetFragment.java
/**
* This method will run the entry animation
*/
private void runEnterAnimation() {
// We can now make it visible
imageView.setVisibility(View.VISIBLE);
// finally, run the animation
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
imageView.animate()
.setDuration(300)
.setInterpolator(new AccelerateDecelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.translationX(0)
.translationY(0)
.start();
}
}
项目:revolution-irc
文件:ImageViewTintUtils.java
public static void animateTint(ImageView view, int from, int to, int duration) {
final float[] fromHSL = new float[3];
final float[] toHSL = new float[3];
float[] currentHSL = new float[3];
ColorUtils.colorToHSL(from, fromHSL);
ColorUtils.colorToHSL(to, toHSL);
int fromAlpha = Color.alpha(from);
int toAlpha = Color.alpha(to);
final ValueAnimator anim = ObjectAnimator.ofFloat(0f, 1f);
anim.addUpdateListener((ValueAnimator animation) -> {
float mul = (Float) animation.getAnimatedValue();
ColorUtils.blendHSL(fromHSL, toHSL, mul, currentHSL);
int color = ColorUtils.HSLToColor(currentHSL);
color = ColorUtils.setAlphaComponent(color, fromAlpha +
(int) ((toAlpha - fromAlpha) * mul));
setTint(view, color);
});
anim.setDuration(duration);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.start();
}
项目:MiniPay
文件:ZhiActivity.java
private void initData() {
Config config = (Config) getIntent().getSerializableExtra(MiniPayUtils.EXTRA_KEY_PAY_CONFIG);
this.wechatQaImage = config.getWechatQaImage();
this.aliQaImage = config.getAliQaImage();
this.wechatTip = config.getWechatTip();
this.aliTip = config.getAliTip();
this.aliZhiKey = config.getAliZhiKey();
if (!checkLegal()) {
throw new IllegalStateException("MiniPay Config illegal!!!");
} else {
if (TextUtils.isEmpty(wechatTip)) wechatTip = getString(R.string.wei_zhi_tip);
if (TextUtils.isEmpty(aliTip)) aliTip = getString(R.string.ali_zhi_tip);
mZhiBg.setBackgroundResource(R.drawable.common_bg);
mTitleTv.setText(R.string.wei_zhi_title);
mSummeryTv.setText(wechatTip);
mQaImage.setImageResource(wechatQaImage);
}
ObjectAnimator animator = ObjectAnimator.ofFloat(mTip, "alpha", 0, 0.66f, 1.0f, 0);
animator.setDuration(2888);
animator.setRepeatCount(6);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setRepeatMode(ValueAnimator.REVERSE);
animator.start();
}
项目:q-mail
文件:SecurityInfoDialog.java
private void prepareIconAnimation() {
authenticationText.setAlpha(0.0f);
trustText.setAlpha(0.0f);
dialogView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
float halfVerticalPixelDifference = (trustIconFrame.getY() - authenticationIconFrame.getY()) / 2.0f;
authenticationIconFrame.setTranslationY(halfVerticalPixelDifference);
trustIconFrame.setTranslationY(-halfVerticalPixelDifference);
authenticationIconFrame.animate().translationY(0)
.setStartDelay(ICON_ANIM_DELAY)
.setDuration(ICON_ANIM_DURATION)
.setInterpolator(new AccelerateDecelerateInterpolator())
.start();
trustIconFrame.animate().translationY(0)
.setStartDelay(ICON_ANIM_DELAY)
.setDuration(ICON_ANIM_DURATION)
.setInterpolator(new AccelerateDecelerateInterpolator())
.start();
authenticationText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();
trustText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();
view.removeOnLayoutChangeListener(this);
}
});
}
项目:GitHub
文件:PullLoadMoreRecyclerView.java
public void setPullLoadMoreCompleted() {
isRefresh = false;
setRefreshing(false);
isLoadMore = false;
mFooterView.animate()
.translationY(mFooterView.getHeight())
.setDuration(300)
.setInterpolator(new AccelerateDecelerateInterpolator())
.start();
}
项目:RecyclerViewAnimation
文件:MyLayoutAnimationHelper.java
/**
* 从左侧进入,并带有弹性的动画
*
* @return
*/
public static AnimationSet getAnimationSetFromLeft() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, -1.0f, RELATIVE_TO_SELF, 0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX1.setDuration(300);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, -0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX2.setStartOffset(300);
translateX2.setInterpolator(new DecelerateInterpolator());
translateX2.setDuration(50);
TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX3.setStartOffset(350);
translateX3.setInterpolator(new DecelerateInterpolator());
translateX3.setDuration(50);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
alphaAnimation.setDuration(400);
alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.addAnimation(translateX1);
animationSet.addAnimation(translateX2);
animationSet.addAnimation(translateX3);
//animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(400);
return animationSet;
}
项目:GitHub
文件:WaveView.java
public void startDropAnimation() {
// show dropBubble again
mDisappearCircleAnimator = ValueAnimator.ofFloat(1.f, 1.f);
mDisappearCircleAnimator.setDuration(1);
mDisappearCircleAnimator.start();
mDropCircleAnimator = ValueAnimator.ofFloat(500 * (mWidth / 1440.f), mMaxDropHeight);
mDropCircleAnimator.setDuration(DROP_CIRCLE_ANIMATOR_DURATION);
mDropCircleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mCurrentCircleCenterY = (float) animation.getAnimatedValue();
postInvalidateOnAnimation();
}
});
mDropCircleAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
mDropCircleAnimator.start();
mDropVertexAnimator = ValueAnimator.ofFloat(0.f, mMaxDropHeight - mDropCircleRadius);
mDropVertexAnimator.setDuration(DROP_VERTEX_ANIMATION_DURATION);
mDropVertexAnimator.addUpdateListener(mAnimatorUpdateListener);
mDropVertexAnimator.start();
mDropBounceVerticalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
mDropBounceVerticalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
mDropBounceVerticalAnimator.addUpdateListener(mAnimatorUpdateListener);
mDropBounceVerticalAnimator.setInterpolator(new DropBounceInterpolator());
mDropBounceVerticalAnimator.setStartDelay(DROP_VERTEX_ANIMATION_DURATION);
mDropBounceVerticalAnimator.start();
mDropBounceHorizontalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
mDropBounceHorizontalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
mDropBounceHorizontalAnimator.addUpdateListener(mAnimatorUpdateListener);
mDropBounceHorizontalAnimator.setInterpolator(new DropBounceInterpolator());
mDropBounceHorizontalAnimator.setStartDelay(
(long) (DROP_VERTEX_ANIMATION_DURATION + DROP_BOUNCE_ANIMATOR_DURATION * 0.25));
mDropBounceHorizontalAnimator.start();
}
项目:GitHub
文件:FragmentContainerHelper.java
public void setInterpolator(Interpolator interpolator) {
if (interpolator == null) {
mInterpolator = new AccelerateDecelerateInterpolator();
} else {
mInterpolator = interpolator;
}
}
项目:GCSApp
文件:PullLoadMoreRecyclerView.java
public void setPullLoadMoreCompleted() {
isRefresh = false;
setRefreshing(false);
isLoadMore = false;
mFooterView.animate()
.translationY(mFooterView.getHeight())
.setDuration(300)
.setInterpolator(new AccelerateDecelerateInterpolator())
.start();
}
项目:Flashcards-Demo
文件:FlipAnimation.java
public FlipAnimation(View fromView, View toView) {
this.fromView = fromView;
this.toView = toView;
setDuration(700);
setFillAfter(false);
setInterpolator(new AccelerateDecelerateInterpolator());
}