/**
* 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();
}
java类android.view.animation.AccelerateDecelerateInterpolator的实例源码
PhoneTabSwitcherLayout.java 文件源码
项目:ChromeLikeTabSwitcher
阅读 27
收藏 0
点赞 0
评论 0
AnimationService.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 28
收藏 0
点赞 0
评论 0
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);
}
PhoneTabSwitcherLayout.java 文件源码
项目:NeoTerm
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
RoundProgressView.java 文件源码
项目:GitHub
阅读 26
收藏 0
点赞 0
评论 0
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());
}
PullLoadMoreRecyclerView.java 文件源码
项目:GitHub
阅读 36
收藏 0
点赞 0
评论 0
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();
}
}
RoundProgressView.java 文件源码
项目:GitHub
阅读 28
收藏 0
点赞 0
评论 0
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());
}
AnimationUtils.java 文件源码
项目:Xndroid
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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;
}
BubblePageIndicator.java 文件源码
项目:BubblePagerIndicator
阅读 22
收藏 0
点赞 0
评论 0
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();
}
ScannerOverlayView.java 文件源码
项目:fingerblox
阅读 28
收藏 0
点赞 0
评论 0
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);
}
ViewAnimationUtils.java 文件源码
项目:Nibo
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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();
}
RoundProgressView.java 文件源码
项目:Rxjava2.0Demo
阅读 26
收藏 0
点赞 0
评论 0
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());
}
CustomSharedTransitionActivity.java 文件源码
项目:SunmiUI
阅读 26
收藏 0
点赞 0
评论 0
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();
}
PhoneTabSwitcherLayout.java 文件源码
项目:ChromeLikeTabSwitcher
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}
};
}
ObjectAnimatorActivity.java 文件源码
项目:AnimationShowcase
阅读 30
收藏 0
点赞 0
评论 0
@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;
}
CircularRevealLayout.java 文件源码
项目:react-native-android-circular-reveal
阅读 26
收藏 0
点赞 0
评论 0
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();
}
CircularRevealLayout.java 文件源码
项目:react-native-android-circular-reveal
阅读 34
收藏 0
点赞 0
评论 0
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();
}
SkinRotateAnimator3.java 文件源码
项目:AndroidSkinAnimator
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
UpdateDialogHandler.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 24
收藏 0
点赞 0
评论 0
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);
}
MainActivity.java 文件源码
项目:Slide-RSS
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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();
}
ViewPropertyAnimatorActivity.java 文件源码
项目:AnimationShowcase
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
RoundProgressView.java 文件源码
项目:SmartRefreshLayout
阅读 25
收藏 0
点赞 0
评论 0
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());
}
ViewAnimationUtils.java 文件源码
项目:JewelryUI
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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();
}
ViewAnimationUtils.java 文件源码
项目:JewelryUI
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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();
}
RoundProgressView.java 文件源码
项目:SmartRefresh
阅读 26
收藏 0
点赞 0
评论 0
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());
}
DonationActivity.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 24
收藏 0
点赞 0
评论 0
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();
}
ProfileAnimatedMenu.java 文件源码
项目:ModesoActionOverlay-Android
阅读 24
收藏 0
点赞 0
评论 0
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();
}
FlowerAnimation.java 文件源码
项目:Mobike
阅读 24
收藏 0
点赞 0
评论 0
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();
}
AnimationService.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 25
收藏 0
点赞 0
评论 0
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);
}
PieChartRotationAnimatorV8.java 文件源码
项目:boohee_v5.6
阅读 27
收藏 0
点赞 0
评论 0
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();
}
DonationActivity.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 23
收藏 0
点赞 0
评论 0
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();
}