java类android.view.animation.AnticipateInterpolator的实例源码

TranslationHideAnimator.java 文件源码 项目:AndroidSkinAnimator 阅读 43 收藏 0 点赞 0 评论 0
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationX", view.getLeft(), view.getRight()));
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new AnticipateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
ScaleHideAnimator.java 文件源码 项目:AndroidSkinAnimator 阅读 31 收藏 0 点赞 0 评论 0
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("scaleX", 1, 0),
            PropertyValuesHolder.ofFloat("scaleY", 1, 0)
    );
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new AnticipateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
ShareCard.java 文件源码 项目:Bigbang 阅读 27 收藏 0 点赞 0 评论 0
public void hide() {
    post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(ShareCard.this, "height", 0);
            objectAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    setVisibility(GONE);
                    if (mListener != null) {
                        mListener.onClick(ShareCard.this);
                    }
                }
            });
            objectAnimator.setDuration(500);
            objectAnimator.setInterpolator(new AnticipateInterpolator());
            objectAnimator.setRepeatCount(0);
            objectAnimator.start();
        }
    });
}
IntroCard.java 文件源码 项目:Bigbang 阅读 26 收藏 0 点赞 0 评论 0
public void hide() {
    post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(IntroCard.this, "height", 0);
            objectAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    setVisibility(GONE);
                    if (mListener != null) {
                        mListener.onClick(IntroCard.this);
                    }
                }
            });
            objectAnimator.setDuration(500);
            objectAnimator.setInterpolator(new AnticipateInterpolator());
            objectAnimator.setRepeatCount(0);
            objectAnimator.start();
        }
    });
}
DemoLikePathActivity.java 文件源码 项目:ArcLayout-master 阅读 26 收藏 0 点赞 0 评论 0
@SuppressWarnings("NewApi")
private void hideMenu() {

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

  for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
    animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
  }

  AnimatorSet animSet = new AnimatorSet();
  animSet.setDuration(400);
  animSet.setInterpolator(new AnticipateInterpolator());
  animSet.playTogether(animList);
  animSet.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      menuLayout.setVisibility(View.INVISIBLE);
    }
  });
  animSet.start();

}
MainActivity.java 文件源码 项目:ArcLayout-master 阅读 31 收藏 0 点赞 0 评论 0
@SuppressWarnings("NewApi")
private void hideMenu() {

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

    for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
        animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
    }

    AnimatorSet animSet = new AnimatorSet();
    animSet.setDuration(time);
    animSet.setInterpolator(new AnticipateInterpolator());
    animSet.playTogether(animList);
    animSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            menuLayout.setVisibility(View.GONE);
        }
    });
    animSet.start();

}
AnimatorUtils.java 文件源码 项目:AndroidArcMenu 阅读 26 收藏 0 点赞 0 评论 0
static void hideMenu(ViewGroup viewGroup, Point touchPoint) {
    List<Animator> animList = new ArrayList<>();

    for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
        animList.add(createHideItemAnimator(viewGroup.getChildAt(i), touchPoint));
    }

    AnimatorSet animSet = new AnimatorSet();
    animSet.setDuration(ANIM_DURATION);
    animSet.setInterpolator(new AnticipateInterpolator());
    animSet.playTogether(animList);
    animSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
        }
    });
    animSet.start();
}
AnimatorUtils.java 文件源码 项目:AndroidArcMenu 阅读 29 收藏 0 点赞 0 评论 0
static void openMenu(ViewGroup viewGroup, int openIndex, AnimatorListenerAdapter endListener) {
    List<Animator> animList = new ArrayList<>();

    for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
        if (openIndex == i) {
            animList.add(createOpenItemAnimator(viewGroup.getChildAt(i)));
        } else {
            animList.add(createStayHideItemAnimator(viewGroup.getChildAt(i)));
        }
    }
    AnimatorSet animSet = new AnimatorSet();
    animSet.setDuration(ANIM_DURATION);
    animSet.setInterpolator(new AnticipateInterpolator());
    animSet.playTogether(animList);
    animSet.addListener(endListener);
    animSet.start();
}
CircleMenu.java 文件源码 项目:TanTanPaneView 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 启动取消动画
 */
private void startCancelMenuAnima() {
    ValueAnimator cancelAnima = ValueAnimator.ofFloat(1.f, 100.f);
    cancelAnima.setDuration(500);
    cancelAnima.setInterpolator(new AnticipateInterpolator());
    cancelAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            fraction = valueAnimator.getAnimatedFraction();
            itemMenuRadius = (1 - fraction) * partSize;
            itemIconSize = (int) ((1 - fraction) * iconSize);
            invalidate();
        }
    });
    cancelAnima.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            status = STATUS_MENU_CLOSED;
            if (onMenuStatusChangeListener != null)
                onMenuStatusChangeListener.onMenuClosed();
        }
    });
    cancelAnima.start();
}
EditTextAnimations.java 文件源码 项目:animated-spans 阅读 27 收藏 0 点赞 0 评论 0
public static void acceptAndClear(final EditText editText) {
    Spannable text = editText.getText();
    if (TextUtils.isEmpty(text)) {
        return;
    }
    PropertySpan propertySpan = new PropertySpan(editText);
    propertySpan.setClipOffset(0, editText.getResources().getDimensionPixelOffset(R.dimen.clip_offset_bottom));
    text.setSpan(propertySpan, 0, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    editText.setText(text);

    ObjectAnimator moveUp = ObjectAnimator.ofFloat(propertySpan, PropertySpan.TRANSLATION_Y, 0, -editText.getHeight() / 4);
    moveUp.setDuration(300);
    moveUp.setInterpolator(new AnticipateInterpolator());
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(propertySpan, PropertySpan.ALPHA, 1, 0);
    fadeOut.setDuration(300);
    AnimatorSet set = new AnimatorSet();
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            editText.setText(null);
        }
    });
    set.playTogether(moveUp, fadeOut);
    set.start();
}
SegmentedButtonGroup.java 文件源码 项目:SegmentedButton 阅读 30 收藏 0 点赞 0 评论 0
private void initInterpolations() {
    ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
        add(FastOutSlowInInterpolator.class);
        add(BounceInterpolator.class);
        add(LinearInterpolator.class);
        add(DecelerateInterpolator.class);
        add(CycleInterpolator.class);
        add(AnticipateInterpolator.class);
        add(AccelerateDecelerateInterpolator.class);
        add(AccelerateInterpolator.class);
        add(AnticipateOvershootInterpolator.class);
        add(FastOutLinearInInterpolator.class);
        add(LinearOutSlowInInterpolator.class);
        add(OvershootInterpolator.class);
    }};

    try {
        interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
DrawerGradientActivity.java 文件源码 项目:android-transition 阅读 31 收藏 0 点赞 0 评论 0
public void updateTransition(View v) {
    mDrawerListenerAdapter.removeAllTransitions();

    ViewTransitionBuilder builder = ViewTransitionBuilder.transit(mGradient).translationX(-mGradient.getWidth(), 0);
    switch (v.getId()) {
        case R.id.interpolator_default:
            break;
        case R.id.interpolator_linear:
            builder.interpolator(new LinearInterpolator());
            break;
        case R.id.interpolator_accelerate:
            builder.interpolator(new AccelerateInterpolator());
            break;
        case R.id.interpolator_decelerate:
            builder.interpolator(new DecelerateInterpolator());
            break;
        case R.id.interpolator_fastout:
            builder.interpolator(new FastOutLinearInInterpolator());
            break;
        case R.id.interpolator_anticipate:
            builder.interpolator(new AnticipateInterpolator());
            break;
    }
    mDrawerListenerAdapter.addTransition(builder);
}
FragmentFingerprint.java 文件源码 项目:breadwallet-android 阅读 28 收藏 0 点赞 0 评论 0
private void animateSignalSlide(final boolean reverse) {
    float layoutTY = fingerPrintLayout.getTranslationY();
    if (!reverse) {
        fingerPrintLayout.setTranslationY(layoutTY + BreadActivity.screenParametersPoint.y);
        fingerPrintLayout.animate()
                .translationY(layoutTY)
                .setDuration(ANIMATION_DURATION + 200)
                .setInterpolator(new DecelerateOvershootInterpolator(2.0f, 1f))
                .withLayer();
    } else {
        fingerPrintLayout.animate()
                .translationY(1500)
                .setDuration(ANIMATION_DURATION)
                .withLayer().setInterpolator(new AnticipateInterpolator(2f)).setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                if (getActivity() != null)
                    getActivity().getFragmentManager().beginTransaction().remove(FragmentFingerprint.this).commit();
            }
        });

    }

}
MainActivity.java 文件源码 项目:CircularProgressDrawable 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Style 3 animation will turn a 3/4 animation with Anticipate/Overshoot interpolation to a
 * blank waiting - like state, wait for 2 seconds then return to the original state
 *
 * @return Animation
 */
private Animator prepareStyle3Animation() {
    AnimatorSet animation = new AnimatorSet();

    ObjectAnimator progressAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0.75f, 0f);
    progressAnimation.setDuration(1200);
    progressAnimation.setInterpolator(new AnticipateInterpolator());

    Animator innerCircleAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0f);
    innerCircleAnimation.setDuration(1200);
    innerCircleAnimation.setInterpolator(new AnticipateInterpolator());

    ObjectAnimator invertedProgress = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0f, 0.75f);
    invertedProgress.setDuration(1200);
    invertedProgress.setStartDelay(3200);
    invertedProgress.setInterpolator(new OvershootInterpolator());

    Animator invertedCircle = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0f, 0.75f);
    invertedCircle.setDuration(1200);
    invertedCircle.setStartDelay(3200);
    invertedCircle.setInterpolator(new OvershootInterpolator());

    animation.playTogether(progressAnimation, innerCircleAnimation, invertedProgress, invertedCircle);
    return animation;
}
UDInterpolator.java 文件源码 项目:LuaViewPlayground 阅读 33 收藏 0 点赞 0 评论 0
public static Interpolator parse(Integer type, Float cycles) {
        if (type != null) {
            switch (type) {
                case 0:
                    return new AccelerateDecelerateInterpolator();
                case 1:
                    return new AccelerateInterpolator();
                case 2:
                    return new AnticipateInterpolator();
                case 3:
                    return new AnticipateOvershootInterpolator();
                case 4:
                    return new BounceInterpolator();
                case 5:
                    return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
                case 6:
                    return new DecelerateInterpolator();
                case 7:
                    return new LinearInterpolator();
                case 8:
                    return new OvershootInterpolator();
                //暂时不支持的
//            case 7: return new FastOutLinearInterplator();
//            case 8: return new FastOutSlowInInterplator();
//            case 10: return new LinearOutSlowInInterplator();
//            case 12: return new PathInterplator();
                default:
                    return new LinearInterpolator();
            }
        } else {
            return new LinearInterpolator();
        }
    }
TranslationAnimator.java 文件源码 项目:AndroidSkinAnimator 阅读 43 收藏 0 点赞 0 评论 0
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft(), view.getRight()))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new AnticipateInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getRight(), view.getLeft()))
            .setDuration(AFTER_DURATION * 2);
    afterAnimator.setInterpolator(new BounceInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            targetView.setAlpha(1);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });
    return this;
}
Utils.java 文件源码 项目:Farmacias 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Creates interpolator.
 *
 * @param interpolatorType
 * @return
 */
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
    switch (interpolatorType) {
        case ACCELERATE_DECELERATE_INTERPOLATOR:
            return new AccelerateDecelerateInterpolator();
        case ACCELERATE_INTERPOLATOR:
            return new AccelerateInterpolator();
        case ANTICIPATE_INTERPOLATOR:
            return new AnticipateInterpolator();
        case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
            return new AnticipateOvershootInterpolator();
        case BOUNCE_INTERPOLATOR:
            return new BounceInterpolator();
        case DECELERATE_INTERPOLATOR:
            return new DecelerateInterpolator();
        case FAST_OUT_LINEAR_IN_INTERPOLATOR:
            return new FastOutLinearInInterpolator();
        case FAST_OUT_SLOW_IN_INTERPOLATOR:
            return new FastOutSlowInInterpolator();
        case LINEAR_INTERPOLATOR:
            return new LinearInterpolator();
        case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
            return new LinearOutSlowInInterpolator();
        case OVERSHOOT_INTERPOLATOR:
            return new OvershootInterpolator();
        default:
            return new LinearInterpolator();
    }
}
AnimationUtil.java 文件源码 项目:Hotspot-master-devp 阅读 28 收藏 0 点赞 0 评论 0
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch (interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
NeuralModelActivity.java 文件源码 项目:Synapse 阅读 26 收藏 0 点赞 0 评论 0
public void onConfirm(View view) {
    final Model model = checkInputs();

    if (model == null) {
        return;
    }

    final Intent intent = new Intent(this, MainService.class);
    intent.putExtra(MainService.ACTION_KEY, MainService.ACTION_TRAIN);
    intent.putExtra(MainService.EXTRAS_NEURAL_CONFIG, model);
    startService(intent);

    final int height = mContainer.getHeight();
    final Activity that = this;

    mPage.setClickable(false);

    mContainer.animate()
            .y(-height)
            .alpha(0F)
            .setInterpolator(new AnticipateInterpolator())
            .setDuration(300)
            .withEndAction(new Runnable() {
                @Override
                public void run() {
                    if (!that.isFinishing()) {
                        that.finish();
                    }
                }
            }).start();

    Tracker.getInstance()
            .event(TrackCons.Model.CLICK_TRAIN)
            .put(TrackCons.Key.MSG, snapshot(model))
            .log();
}
OpacityAnimation.java 文件源码 项目:AnimatedArcProgressView 阅读 26 收藏 0 点赞 0 评论 0
private void initAuraAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
    final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
    opacityAnimator.setInterpolator(new AnticipateInterpolator(opacityDecelerateFactor));
    opacityAnimator.setIntValues(255, 50, 255, 50);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
ObjectAnimationActivity.java 文件源码 项目:MaterialDesignDemo 阅读 31 收藏 0 点赞 0 评论 0
private void startAnimation() {
        ObjectAnimator oa = ObjectAnimator.ofFloat(mIvPic, "translationY", 0, 400);
        // 加速减速插值器
//        AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
        // 加速插值器
//        AccelerateInterpolator interpolator = new AccelerateInterpolator(0.8f);
        // 回荡秋千插值器
        AnticipateInterpolator interpolator = new AnticipateInterpolator(0.8f);
        oa.setInterpolator(interpolator);
        oa.start();
    }
Utils.java 文件源码 项目:Tab_Navigator 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Creates interpolator.
 * @return  a timeinterpolator
 * @param interpolatorType a int value from 0 to 10
 */
public static TimeInterpolator createInterpolator(
    @IntRange(from = 0, to = 10) final int interpolatorType) {
  switch (interpolatorType) {
    case ACCELERATE_DECELERATE_INTERPOLATOR:
      return new AccelerateDecelerateInterpolator();
    case ACCELERATE_INTERPOLATOR:
      return new AccelerateInterpolator();
    case ANTICIPATE_INTERPOLATOR:
      return new AnticipateInterpolator();
    case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
      return new AnticipateOvershootInterpolator();
    case BOUNCE_INTERPOLATOR:
      return new BounceInterpolator();
    case DECELERATE_INTERPOLATOR:
      return new DecelerateInterpolator();
    case FAST_OUT_LINEAR_IN_INTERPOLATOR:
      return new FastOutLinearInInterpolator();
    case FAST_OUT_SLOW_IN_INTERPOLATOR:
      return new FastOutSlowInInterpolator();
    case LINEAR_INTERPOLATOR:
      return new LinearInterpolator();
    case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
      return new LinearOutSlowInInterpolator();
    case OVERSHOOT_INTERPOLATOR:
      return new OvershootInterpolator();
    default:
      return new LinearInterpolator();
  }
}
PathProgressDrawable.java 文件源码 项目:samples 阅读 29 收藏 0 点赞 0 评论 0
public void setAnimatedPoints(int animatedPoints) {
        float dist = 1f / (float) (animatedPoints - 2);
//        Interpolator interpolator = new AccelerateInterpolator();
//        Interpolator interpolator = new DecelerateInterpolator();
        Interpolator interpolator = new AnticipateInterpolator();

        mFactor = new float[animatedPoints];
        for (int i = 0; i < animatedPoints - 1; i++) {
            mFactor[i] = 1f + interpolator.getInterpolation(dist * i);
        }
        mFactor[animatedPoints - 1] = 1f;
    }
MainActivity.java 文件源码 项目:TanTanPaneView 阅读 21 收藏 0 点赞 0 评论 0
private void initView() {
//       tv = (MarqueTextView) findViewById(R.id.tv_marque);
//        Timer timer =  new Timer();
//        TimerTask task = new TimerTask() {
//            @Override
//            public void run() {
//                index ++;
//                if (index > 2) {
//                    index = 0;
//                }
//                MainActivity.this.runOnUiThread(new Runnable() {
//                    @Override
//                    public void run() {
//                        tv.setText(names[index]);
//                    }
//                });
//
//            }
//        };
//        timer.schedule(task,1000,1000);
        findViewById(R.id.iv_head).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.e("aaaa","onclick");
//                v.animate().setDuration(1000).scaleX(2).scaleY(2).setInterpolator(new BounceInterpolator()).start();
                AnimatorSet set = new AnimatorSet();
                set.setInterpolator(new AnticipateInterpolator());
                set.playTogether(
                        ObjectAnimator.ofFloat(v,"scaleX",1f,2f),
                         ObjectAnimator.ofFloat(v,"scaleX",2f,1f),
                         ObjectAnimator.ofFloat(v,"scaleY",1f,2f),
                         ObjectAnimator.ofFloat(v,"scaleY",2f,1f));
                set.setDuration(1000).start();
            }
        });


    }
RotateAnimater.java 文件源码 项目:JPTabBar 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void onSelectChanged(View v, boolean selected) {
    int end = selected ? 360 : 0;
    ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(v, "rotation",  end);
    rotateAnimator.setDuration(400);
    rotateAnimator.setInterpolator(new AnticipateInterpolator());
    rotateAnimator.start();
}
JumpAnimater.java 文件源码 项目:JPTabBar 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void onSelectChanged(View v, boolean selected) {
    int end = selected?-10:0;
    ObjectAnimator jumpAnimator = ObjectAnimator.ofFloat(v,"translationY",end);
    jumpAnimator.setDuration(300);
    jumpAnimator.setInterpolator(new AnticipateInterpolator());
    jumpAnimator.start();
}
GeneralAnimatorGenerator.java 文件源码 项目:IndicatorBox 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Make a shrink animation.
 * @param duration
 * @return
 */
public static Animator shrinkAnimator(int duration){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator xExpandAnimator = new ObjectAnimator();
    xExpandAnimator.setPropertyName("scaleX");
    xExpandAnimator.setFloatValues(1.0f, 0.5f);
    ObjectAnimator yExpandAnimator = new ObjectAnimator();
    yExpandAnimator.setPropertyName("scaleY");
    yExpandAnimator.setFloatValues(1.0f, 0.5f);
    animatorSet.play(xExpandAnimator).with(yExpandAnimator);
    animatorSet.setDuration(duration);
    animatorSet.setInterpolator(new AnticipateInterpolator());
    return animatorSet;
}
AnimationController.java 文件源码 项目:AyoSunny 阅读 33 收藏 0 点赞 0 评论 0
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch (interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
RadioRealButtonGroup.java 文件源码 项目:RadioRealButton 阅读 33 收藏 0 点赞 0 评论 0
private void initInterpolations() {
    Class[] interpolations = {
            FastOutSlowInInterpolator.class,
            BounceInterpolator.class,
            LinearInterpolator.class,
            DecelerateInterpolator.class,
            CycleInterpolator.class,
            AnticipateInterpolator.class,
            AccelerateDecelerateInterpolator.class,
            AccelerateInterpolator.class,
            AnticipateOvershootInterpolator.class,
            FastOutLinearInInterpolator.class,
            LinearOutSlowInInterpolator.class,
            OvershootInterpolator.class};

    try {
        interpolatorText = (Interpolator) interpolations[animateTextsEnter].newInstance();
        interpolatorDrawablesEnter = (Interpolator) interpolations[animateDrawablesEnter].newInstance();
        interpolatorSelector = (Interpolator) interpolations[animateSelector].newInstance();

        interpolatorTextExit = (Interpolator) interpolations[animateTextsExit].newInstance();
        interpolatorDrawablesExit = (Interpolator) interpolations[animateDrawablesExit].newInstance();

    } catch (Exception e) {
        e.printStackTrace();
    }
}
AnimationController.java 文件源码 项目:lunzi 阅读 29 收藏 0 点赞 0 评论 0
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch (interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}


问题


面经


文章

微信
公众号

扫码关注公众号