本文整理汇总了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();
}
示例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();
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}