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


Java Animator.setInterpolator方法代碼示例

本文整理匯總了Java中android.animation.Animator.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java Animator.setInterpolator方法的具體用法?Java Animator.setInterpolator怎麽用?Java Animator.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.Animator的用法示例。


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

示例1: performCircularReveal

import android.animation.Animator; //導入方法依賴的package包/類
private void performCircularReveal(View show) {
    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,代碼來源:ImageSharedTransitionActivity.java

示例2: startAnimators

import android.animation.Animator; //導入方法依賴的package包/類
public static void startAnimators(final View view, int startOffsetX, int startOffsetY, long delay) {
    if (view.getVisibility() == View.VISIBLE && view.getAlpha() != 0f) {
        view.clearAnimation();
        view.animate().cancel();
        final Resources res = view.getResources();
        final float endAlpha = view.getAlpha();
        final float endTranslateX = view.getTranslationX();
        final float endTranslateY = view.getTranslationY();
        view.setAlpha(0);
        final Animator fade = ObjectAnimator.ofFloat(view, View.ALPHA, endAlpha);
        fade.setDuration(res.getInteger(R.integer.material_in_fade_anim_duration));
        fade.setInterpolator(new AccelerateInterpolator());
        fade.setStartDelay(delay);
        fade.start();
        ViewPropertyAnimator slide = view.animate();
        if (startOffsetY != 0) {
            view.setTranslationY(startOffsetY);
            slide.translationY(endTranslateY);
        } else {
            view.setTranslationX(startOffsetX);
            slide.translationX(endTranslateX);
        }
        slide.setInterpolator(new DecelerateInterpolator(2));
        slide.setDuration(res.getInteger(R.integer.material_in_slide_anim_duration));
        slide.setStartDelay(delay);
        slide.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationCancel(Animator animation) {
                if (fade.isStarted()) {
                    fade.cancel();
                }
                view.setAlpha(endAlpha);
                view.setTranslationX(endTranslateX);
                view.setTranslationY(endTranslateY);
            }
        });
        slide.start();
    }
}
 
開發者ID:rumaan,項目名稱:file.io-app,代碼行數:40,代碼來源:MaterialIn.java

示例3: createShowUpAnimator

import android.animation.Animator; //導入方法依賴的package包/類
public Animator createShowUpAnimator(final View target) {
    if (mHasCustomAnimationParams) {
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_X, mShowUpStartXScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_Y, mShowUpStartYScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final AnimatorSet showUpAnimator = new AnimatorSet();
        showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
        showUpAnimator.setDuration(mShowUpDuration);
        showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
        return showUpAnimator;
    }
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mShowUpAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(DECELERATE_INTERPOLATOR);
    return animator;
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:21,代碼來源:KeyPreviewDrawParams.java

示例4: setDragging

import android.animation.Animator; //導入方法依賴的package包/類
private void setDragging(boolean value, boolean animated) {
    if (dragging == value) {
        return;
    }
    dragging = value;
    float target = dragging ? 1.0f : 0.0f;
    if (animated) {
        Animator a = ObjectAnimator.ofFloat(this, "draggingFactor", draggingFactor, target);
        a.setInterpolator(interpolator);
        int duration = 300;
        if (wasChangingWeight) {
            duration += weight * 75;
        }
        a.setDuration(duration);
        a.start();
    } else {
        setDraggingFactor(target);
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:20,代碼來源:ColorPicker.java

示例5: createDismissAnimator

import android.animation.Animator; //導入方法依賴的package包/類
public Animator createDismissAnimator(final View target) {
    if (mHasCustomAnimationParams) {
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_X, mDismissEndXScale);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_Y, mDismissEndYScale);
        final AnimatorSet dismissAnimator = new AnimatorSet();
        dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
        final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
        dismissAnimator.setDuration(dismissDuration);
        dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
        return dismissAnimator;
    }
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mDismissAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(ACCELERATE_INTERPOLATOR);
    return animator;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:20,代碼來源:KeyPreviewDrawParams.java

示例6: showMenu

import android.animation.Animator; //導入方法依賴的package包/類
private void showMenu(int cx, int cy, float startRadius, float endRadius) {
  menuLayout.setVisibility(View.VISIBLE);

  List<Animator> animList = new ArrayList<>();

  Animator revealAnim = createCircularReveal(menuLayout, cx, cy, startRadius, endRadius);
  revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
  revealAnim.setDuration(200);

  animList.add(revealAnim);
  animList.add(createShowItemAnimator(centerItem));

  for (int i = 0, len = arcLayout.getChildCount(); i < len; i++) {
    animList.add(createShowItemAnimator(arcLayout.getChildAt(i)));
  }

  AnimatorSet animSet = new AnimatorSet();
  animSet.playSequentially(animList);
  animSet.start();
}
 
開發者ID:xzg8023,項目名稱:ArcLayout-master,代碼行數:21,代碼來源:DemoLikeTumblrActivity.java

示例7: startConcealAnimation

import android.animation.Animator; //導入方法依賴的package包/類
/**
 */
@Override
public void startConcealAnimation(@NonNull final SearchView searchView) {
	final float[] viewCenter = resolveCenter(searchView, 1.0f, 0.5f);
	final Animator animator = createAnimator(
			searchView,
			viewCenter[0] - searchView.getHeight() / 2f, viewCenter[1],
			calculateRadius(searchView),
			0
	);
	animator.setDuration(concealDuration);
	animator.setInterpolator(interpolator);
	animator.addListener(new AnimatorListenerAdapter() {
		@Override
		public void onAnimationEnd(Animator animation) {
			searchView.setVisibility(View.INVISIBLE);
		}
	});
	animator.start();
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:22,代碼來源:SearchView.java

示例8: performCircularReveal

import android.animation.Animator; //導入方法依賴的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

示例9: onPreDraw

import android.animation.Animator; //導入方法依賴的package包/類
@Override
@TargetApi(VERSION_CODES.LOLLIPOP)
public boolean onPreDraw() {
  heart.getViewTreeObserver().removeOnPreDrawListener(this);
  final int w = heart.getWidth();
  final int h = heart.getHeight();
  Animator reveal = ViewAnimationUtils.createCircularReveal(heart,
                                                            w / 2, h,
                                                            0, (float)Math.sqrt(h*h + (w*w/4)));
  reveal.setInterpolator(new FastOutSlowInInterpolator());
  reveal.setDuration(800);
  reveal.start();
  return false;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:15,代碼來源:InviteActivity.java

示例10: startAnimation

import android.animation.Animator; //導入方法依賴的package包/類
public static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component,
                                  @NonNull WXAnimationBean animationBean, @Nullable String callback) {
  if(component == null){
    return;
  }
  if (component.getHostView() == null) {
    AnimationHolder holder = new AnimationHolder(animationBean, callback);
    component.postAnimation(holder);
    return;
  }
  try {
    Animator animator = createAnimator(animationBean, component.getHostView(),mWXSDKInstance.getViewPortWidth());
    if (animator != null) {
      Animator.AnimatorListener animatorCallback = createAnimatorListener(mWXSDKInstance, callback);
      if(Build.VERSION.SDK_INT<Build.VERSION_CODES.JELLY_BEAN_MR2) {
        component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null);
      }
      Interpolator interpolator = createTimeInterpolator(animationBean);
      if (animatorCallback != null) {
        animator.addListener(animatorCallback);
      }
      if (interpolator != null) {
        animator.setInterpolator(interpolator);
      }
      animator.setDuration(animationBean.duration);
      animator.start();
    }
  } catch (RuntimeException e) {
    e.printStackTrace();
    WXLogUtils.e("", e);
  }
}
 
開發者ID:erguotou520,項目名稱:weex-uikit,代碼行數:33,代碼來源:WXAnimationModule.java

示例11: onViewAttachedToWindow

import android.animation.Animator; //導入方法依賴的package包/類
@Override
public void onViewAttachedToWindow(SuperViewHolder holder) {
    super.onViewAttachedToWindow(holder);
    if (!mFirstOnly || holder.getLayoutPosition() > mLastPosition) {
        for (Animator anim : mSelectAnimation.getAnimators(holder.itemView)) {
            anim.setDuration(mDuration).start();
            anim.setInterpolator(mInterpolator);
        }
        mLastPosition = holder.getLayoutPosition();
    }
}
 
開發者ID:yedashen,項目名稱:UltimateRecyclerView,代碼行數:12,代碼來源:AnimationAdapter.java

示例12: startRevealAnimation

import android.animation.Animator; //導入方法依賴的package包/類
/**
 */
@Override
public void startRevealAnimation(@NonNull SearchView searchView) {
	searchView.setVisibility(View.VISIBLE);
	final float[] viewCenter = resolveCenter(searchView, 1.0f, 0.5f);
	final Animator animator = createAnimator(
			searchView,
			viewCenter[0] - searchView.getHeight() / 2f, viewCenter[1],
			0,
			calculateRadius(searchView)
	);
	animator.setDuration(revealDuration);
	animator.setInterpolator(interpolator);
	animator.start();
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:17,代碼來源:SearchView.java

示例13: animateRevealColorFromCoordinates

import android.animation.Animator; //導入方法依賴的package包/類
private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot, @ColorRes int color, int x, int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
    viewRoot.setBackgroundColor(ContextCompat.getColor(this, color));
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_long));
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.start();
    return anim;
}
 
開發者ID:shenhuanet,項目名稱:AndroidOpen,代碼行數:11,代碼來源:RevealActivity.java

示例14: applyDismissing

import android.animation.Animator; //導入方法依賴的package包/類
/**
 * Applies the interpolator and length to the animator, such that the fling animation is
 * consistent with the finger motion for the case when the animation is making something
 * disappear.
 *
 * @param animator the animator to apply
 * @param currValue the current value
 * @param endValue the end value of the animator
 * @param velocity the current velocity of the motion
 * @param maxDistance the maximum distance for this interaction; the maximum animation length
 *                    gets multiplied by the ratio between the actual distance and this value
 */
void applyDismissing(Animator animator, float currValue, float endValue,
        float velocity, float maxDistance) {
    AnimatorProperties properties = getDismissingProperties(currValue, endValue, velocity,
            maxDistance);
    animator.setDuration(properties.duration);
    animator.setInterpolator(properties.interpolator);
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:20,代碼來源:FlingAnimationUtils.java

示例15: startAnim

import android.animation.Animator; //導入方法依賴的package包/類
/**
 * set anim to start when loading
 *
 * @param anim
 * @param index
 */
protected void startAnim(Animator anim, int index) {
    anim.setDuration(mAnimationDuration).start();
    anim.setInterpolator(mInterpolator);
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:11,代碼來源:BaseFetchLoadAdapter.java


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