當前位置: 首頁>>代碼示例>>Java>>正文


Java DecelerateInterpolator類代碼示例

本文整理匯總了Java中android.view.animation.DecelerateInterpolator的典型用法代碼示例。如果您正苦於以下問題:Java DecelerateInterpolator類的具體用法?Java DecelerateInterpolator怎麽用?Java DecelerateInterpolator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DecelerateInterpolator類屬於android.view.animation包,在下文中一共展示了DecelerateInterpolator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createHideItemAnimator

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
private Animator createHideItemAnimator(final View item) {
  final float dx = centerItem.getX() - item.getX();
  final float dy = centerItem.getY() - item.getY();

  Animator anim = ObjectAnimator.ofPropertyValuesHolder(
      item,
      AnimatorUtils.scaleX(1f, 0f),
      AnimatorUtils.scaleY(1f, 0f),
      AnimatorUtils.translationX(0f, dx),
      AnimatorUtils.translationY(0f, dy)
  );

  anim.setInterpolator(new DecelerateInterpolator());
  anim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      item.setTranslationX(0f);
      item.setTranslationY(0f);
    }
  });
  anim.setDuration(50);
  return anim;
}
 
開發者ID:xzg8023,項目名稱:ArcLayout-master,代碼行數:25,代碼來源:DemoLikeTumblrActivity.java

示例2: showBouceAnimation

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
public void showBouceAnimation() {
    playPauseFab.clearAnimation();

    playPauseFab.setScaleX(0.9f);
    playPauseFab.setScaleY(0.9f);
    playPauseFab.setVisibility(View.VISIBLE);
    playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
    playPauseFab.setPivotY(playPauseFab.getHeight() / 2);

    playPauseFab.animate()
            .setDuration(200)
            .setInterpolator(new DecelerateInterpolator())
            .scaleX(1.1f)
            .scaleY(1.1f)
            .withEndAction(() -> playPauseFab.animate()
                    .setDuration(200)
                    .setInterpolator(new AccelerateInterpolator())
                    .scaleX(1f)
                    .scaleY(1f)
                    .alpha(1f)
                    .start())
            .start();
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:24,代碼來源:HolidayPlaybackControlsFragment.java

示例3: showHeartAnimation

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
public void showHeartAnimation() {
    shuffleButton.clearAnimation();

    shuffleButton.setScaleX(0.9f);
    shuffleButton.setScaleY(0.9f);
    shuffleButton.setVisibility(View.VISIBLE);
    shuffleButton.setPivotX(shuffleButton.getWidth() / 2);
    shuffleButton.setPivotY(shuffleButton.getHeight() / 2);

    shuffleButton.animate()
            .setDuration(200)
            .setInterpolator(new DecelerateInterpolator())
            .scaleX(1.1f)
            .scaleY(1.1f)
            .withEndAction(() -> shuffleButton.animate()
                    .setDuration(200)
                    .setInterpolator(new AccelerateInterpolator())
                    .scaleX(1f)
                    .scaleY(1f)
                    .alpha(1f)
                    .start())
            .start();
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:24,代碼來源:PlaylistDetailActivity.java

示例4: toggleToolbar

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
public void toggleToolbar(boolean show) {
    if (show==showToolbar || toolbarGroup==null) {
        return;
    }

    showToolbar=show;
    if (showToolbar) {
        startTimeOut();
        showSystemUI();
        toolbarGroup.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
    } else {
        if (timeoutSubscription!=null) {
            timeoutSubscription.unsubscribe();
        }
        toolbarGroup.animate().translationY(-toolbarGroup.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
        hideSystemUI();
    }
}
 
開發者ID:garretyoder,項目名稱:Cluttr,代碼行數:19,代碼來源:ViewActivity.java

示例5: completeAnimationImmediately

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
@Thunk void completeAnimationImmediately() {
    if (a != null) {
        a.cancel();
    }

    setInitialAnimationValues(true);
    a = LauncherAnimUtils.ofPropertyValuesHolder(child,
            new PropertyListBuilder()
                    .scale(initScale)
                    .translationX(initDeltaX)
                    .translationY(initDeltaY)
                    .build())
            .setDuration(REORDER_ANIMATION_DURATION);
    a.setInterpolator(new android.view.animation.DecelerateInterpolator(1.5f));
    a.start();
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:17,代碼來源:CellLayout.java

示例6: toggle

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
private void toggle() {
    if (animator != null) {
        animator.cancel();
    }

    animator = ObjectAnimator.ofFloat(this, PROGRESS, isPlay ? 1.0F : 0.0F, isPlay ? 0.0F : 1.0F);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            isPlay = !isPlay;
        }
    });

    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.start();
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:18,代碼來源:PlayPauseDrawable.java

示例7: showInstructionList

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
/**
 * Show the instruction list and hide the sound button.
 * <p>
 * This is based on orientation so the different layouts (for portrait vs. landscape)
 * can be animated appropriately.
 */
public void showInstructionList() {
  int orientation = getContext().getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    ConstraintSet expanded = new ConstraintSet();
    expanded.clone(getContext(), R.layout.instruction_layout_alt);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      TransitionManager.beginDelayedTransition(InstructionView.this);
    }
    expanded.applyTo(instructionLayout);
    instructionListLayout.setVisibility(VISIBLE);
  } else {
    Animation slideDown = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top);
    slideDown.setInterpolator(new DecelerateInterpolator());
    instructionListLayout.setVisibility(VISIBLE);
    instructionListLayout.startAnimation(slideDown);
  }
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:24,代碼來源:InstructionView.java

示例8: initAnimations

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
/**
 * Initializes all animations needed to show / hide views.
 */
private void initAnimations() {
  Context context = getContext();
  rerouteSlideDownTop = AnimationUtils.loadAnimation(context, R.anim.slide_down_top);
  rerouteSlideUpTop = AnimationUtils.loadAnimation(context, R.anim.slide_up_top);

  Animation fadeIn = new AlphaAnimation(0, 1);
  fadeIn.setInterpolator(new DecelerateInterpolator());
  fadeIn.setDuration(300);

  Animation fadeOut = new AlphaAnimation(1, 0);
  fadeOut.setInterpolator(new AccelerateInterpolator());
  fadeOut.setStartOffset(1000);
  fadeOut.setDuration(1000);

  fadeInSlowOut = new AnimationSet(false);
  fadeInSlowOut.addAnimation(fadeIn);
  fadeInSlowOut.addAnimation(fadeOut);
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:22,代碼來源:InstructionView.java

示例9: onFling

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
	if (mode == DRAG) {
		if (flingDuration > 0 && !isAnimating()) {
			float factor = ((float) flingDuration / 1000f) * flingExaggeration;
			float[] values = corrector.getValues();
			float dx = (velocityX * factor) * values[Matrix.MSCALE_X];
			float dy = (velocityY * factor) * values[Matrix.MSCALE_Y];
			PropertyValuesHolder flingX = PropertyValuesHolder.ofFloat(FlingAnimatorHandler.PROPERTY_TRANSLATE_X, values[Matrix.MTRANS_X], values[Matrix.MTRANS_X] + dx);
			PropertyValuesHolder flingY = PropertyValuesHolder.ofFloat(FlingAnimatorHandler.PROPERTY_TRANSLATE_Y, values[Matrix.MTRANS_Y], values[Matrix.MTRANS_Y] + dy);
			valueAnimator = ValueAnimator.ofPropertyValuesHolder(flingX, flingY);
			valueAnimator.setDuration(flingDuration);
			valueAnimator.addUpdateListener(new FlingAnimatorHandler(corrector));
			valueAnimator.setInterpolator(new DecelerateInterpolator());
			valueAnimator.start();
			return true;
		}
	}
	return super.onFling(e1, e2, velocityX, velocityY);
}
 
開發者ID:martinwithaar,項目名稱:PinchToZoom,代碼行數:21,代碼來源:ImageMatrixTouchHandler.java

示例10: LingjuSwipeRefreshLayout

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public LingjuSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:32,代碼來源:LingjuSwipeRefreshLayout.java

示例11: LingjuSwipeUpLoadRefreshLayout

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public LingjuSwipeUpLoadRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:32,代碼來源:LingjuSwipeUpLoadRefreshLayout.java

示例12: createAnimatorToHeadView

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
public void createAnimatorToHeadView(final View v, final float angle)
{
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(200);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.rotationX(90);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(mChildView);
            mHeadLayout.setPivotX(mHeadLayout.getWidth() / 2);
            mHeadLayout.setPivotY(height);
        }
    });
}
 
開發者ID:zongkaili,項目名稱:MenuSet,代碼行數:17,代碼來源:PerseiLayout.java

示例13: onMapClick

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
/**
 * 點擊map,隱藏/顯示Map上的元素
 * @param latLng
 */
@Override
public void onMapClick(LatLng latLng) {
    SearchView search_view = (SearchView) ((Activity)mContext).findViewById(R.id.search_view);
    MapToolsView map_tool = (MapToolsView) ((Activity)mContext).findViewById(R.id.map_tool);

    DisplayMetrics metrics = new DisplayMetrics();
    ((Activity)mContext).getWindowManager().getDefaultDisplay().getMetrics(metrics);

    if (mIsMapElementsShow) {
        mIsMapElementsShow = false;
        search_view.animate().translationY((search_view.getHeight() + dp2px(mContext, 6)) * (-1)).setInterpolator(new DecelerateInterpolator());
        map_tool.animate().translationY(map_tool.getHeight() + dp2px(mContext, 6)).setInterpolator(new DecelerateInterpolator());
    } else {
        mIsMapElementsShow = true;
        search_view.animate().translationY(0).setInterpolator(new DecelerateInterpolator());
        map_tool.animate().translationY(0).setInterpolator(new DecelerateInterpolator());
    }
}
 
開發者ID:sherlockchou86,項目名稱:yphoto,代碼行數:23,代碼來源:MapFragment.java

示例14: enter

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
public static Completable enter(final View view, final int xOffset, final int yOffset) {
    final float startingX = view.getX();
    final float startingY = view.getY();
    return animate(view, new DecelerateInterpolator())
            .fadeIn()
            .translateBy(xOffset, yOffset)
            .onAnimationCancel(aView -> set(aView, startingX, startingY, OPAQUE))
            .schedule();
}
 
開發者ID:0ximDigital,項目名稱:Rx2Animations,代碼行數:10,代碼來源:RxAnimations.java

示例15: smoothScrollTo

import android.view.animation.DecelerateInterpolator; //導入依賴的package包/類
private final void smoothScrollTo(int newScrollValue, long duration, long delayMillis, OnSmoothScrollFinishedListener listener) {
    int oldScrollValue;
    if (this.mCurrentSmoothScrollRunnable != null) {
        this.mCurrentSmoothScrollRunnable.stop();
    }
    switch (getPullToRefreshScrollDirection()) {
        case HORIZONTAL:
            oldScrollValue = getScrollX();
            break;
        default:
            oldScrollValue = getScrollY();
            break;
    }
    if (oldScrollValue != newScrollValue) {
        if (this.mScrollAnimationInterpolator == null) {
            this.mScrollAnimationInterpolator = new DecelerateInterpolator();
        }
        this.mCurrentSmoothScrollRunnable = new SmoothScrollRunnable(oldScrollValue, newScrollValue, duration, listener);
        if (delayMillis > 0) {
            postDelayed(this.mCurrentSmoothScrollRunnable, delayMillis);
        } else {
            post(this.mCurrentSmoothScrollRunnable);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:26,代碼來源:PullToRefreshBase.java


注:本文中的android.view.animation.DecelerateInterpolator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。