当前位置: 首页>>代码示例>>Java>>正文


Java AccelerateDecelerateInterpolator类代码示例

本文整理汇总了Java中android.view.animation.AccelerateDecelerateInterpolator的典型用法代码示例。如果您正苦于以下问题:Java AccelerateDecelerateInterpolator类的具体用法?Java AccelerateDecelerateInterpolator怎么用?Java AccelerateDecelerateInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AccelerateDecelerateInterpolator类属于android.view.animation包,在下文中一共展示了AccelerateDecelerateInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: animateSwipe

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:37,代码来源:PhoneTabSwitcherLayout.java

示例2: setAdapterInsertAnimation

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:19,代码来源:AnimationService.java

示例3: animateReveal

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:30,代码来源:PhoneTabSwitcherLayout.java

示例4: init

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:RoundProgressView.java

示例5: loadMore

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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();

    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:PullLoadMoreRecyclerView.java

示例6: initView

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:RoundProgressView.java

示例7: createRotationTransitionAnimation

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:37,代码来源:AnimationUtils.java

示例8: animateShifting

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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();
}
 
开发者ID:shuhart,项目名称:BubblePagerIndicator,代码行数:26,代码来源:BubblePageIndicator.java

示例9: initAnimation

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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);
}
 
开发者ID:jorenham,项目名称:fingerblox,代码行数:26,代码来源:ScannerOverlayView.java

示例10: liftingFromBottom

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
/**
 * 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();

}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:25,代码来源:ViewAnimationUtils.java

示例11: performCircularReveal

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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();
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:17,代码来源:CustomSharedTransitionActivity.java

示例12: createPeekLayoutListener

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
/**
 * 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);
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:34,代码来源:PhoneTabSwitcherLayout.java

示例13: onTranslateAndFade

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
@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;
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:21,代码来源:ObjectAnimatorActivity.java

示例14: reveal

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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();
}
 
开发者ID:Ibrahim-GHub,项目名称:react-native-android-circular-reveal,代码行数:24,代码来源:CircularRevealLayout.java

示例15: hide

import android.view.animation.AccelerateDecelerateInterpolator; //导入依赖的package包/类
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();
}
 
开发者ID:Ibrahim-GHub,项目名称:react-native-android-circular-reveal,代码行数:21,代码来源:CircularRevealLayout.java


注:本文中的android.view.animation.AccelerateDecelerateInterpolator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。