类android.view.animation.AnticipateInterpolator源码实例Demo

下面列出了怎么用android.view.animation.AnticipateInterpolator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: timecat   文件: ShareCard.java
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();
        }
    });
}
 
源代码2 项目: timecat   文件: IntroCard.java
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();
        }
    });
}
 
@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;
}
 
源代码4 项目: AndroidSkinAnimator   文件: ScaleHideAnimator.java
@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;
}
 
源代码5 项目: SegmentedButton   文件: SegmentedButtonGroup.java
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();
    }
}
 
源代码6 项目: ArcLayout   文件: DemoLikePathActivity.java
@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();

}
 
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);
}
 
源代码8 项目: ParallaxEverywhere   文件: InterpolatorSelector.java
public static Interpolator interpolatorId(int interpolationId) {
    switch (interpolationId) {
        case LINEAR:
        default:
            return new LinearInterpolator();
        case ACCELERATE_DECELERATE:
            return new AccelerateDecelerateInterpolator();
        case ACCELERATE:
            return new AccelerateInterpolator();
        case ANTICIPATE:
            return new AnticipateInterpolator();
        case ANTICIPATE_OVERSHOOT:
            return new AnticipateOvershootInterpolator();
        case BOUNCE:
            return new BounceInterpolator();
        case DECELERATE:
            return new DecelerateInterpolator();
        case OVERSHOOT:
            return new OvershootInterpolator();
        //TODO: this interpolations needs parameters
        //case CYCLE:
        //    return new CycleInterpolator();
        //case PATH:
        //    return new PathInterpolator();
    }
}
 
源代码9 项目: CircularProgressDrawable   文件: MainActivity.java
/**
 * 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;
}
 
源代码10 项目: kAndroid   文件: BezierPraiseAnimator.java
private ValueAnimator getBezierPraiseAnimator(final View target) {
    // 构建贝塞尔曲线的起点,控制点,终点坐标
    float startX = mTargetX;
    float startY = mTargetY;
    int random = mRandom.nextInt(mPraiseIconWidth);
    float endX;
    float endY;
    float controlX;
    final float controlY;

    controlY = startY - mRandom.nextInt(500) - 100;
    // 左右两边
    if (random % 2 == 0) {
        endX = mTargetX - random * 8;
        controlX = mTargetX - random * 2;
    } else {
        endX = mTargetX + random * 8;
        controlX = mTargetX + random * 2;
    }
    endY = mTargetY + random + 400;

    // 构造自定义的贝塞尔估值器
    PraiseEvaluator evaluator = new PraiseEvaluator(new PointF(controlX, controlY));

    ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF(startX, startY), new PointF(endX, endY));
    animator.setInterpolator(new AnticipateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            PointF currentPoint = (PointF) animation.getAnimatedValue();
            target.setX(currentPoint.x);
            target.setY(currentPoint.y);
            // 设置透明度 [1~0]
            target.setAlpha(1.0f - animation.getAnimatedFraction());
        }
    });
    animator.setTarget(target);
    return animator;
}
 
源代码11 项目: VideoOS-Android-SDK   文件: UDInterpolator.java
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();
            default:
                return new LinearInterpolator();
        }
    } else {
        return new LinearInterpolator();
    }
}
 
源代码12 项目: MusicPlayer   文件: Animation.java
public static List<Interpolator> getInterpolatorList() {
    List<Interpolator> interpolatorList = new ArrayList<>();
    interpolatorList.add(new LinearInterpolator());
    interpolatorList.add(new AccelerateInterpolator());
    interpolatorList.add(new DecelerateInterpolator());
    interpolatorList.add(new AccelerateDecelerateInterpolator());
    interpolatorList.add(new OvershootInterpolator());
    interpolatorList.add(new AnticipateInterpolator());
    interpolatorList.add(new AnticipateOvershootInterpolator());
    interpolatorList.add(new BounceInterpolator());
    interpolatorList.add(new FastOutLinearInInterpolator());
    interpolatorList.add(new FastOutSlowInInterpolator());
    interpolatorList.add(new LinearOutSlowInInterpolator());
    return interpolatorList;
}
 
源代码13 项目: MusicPlayer   文件: Animation.java
@NonNull
public static Interpolator getInterpolator(int id) {
    switch (id) {
        case 0:
            return new LinearInterpolator();
        case 1:
            return new AccelerateInterpolator();
        case 2:
            return new DecelerateInterpolator();
        case 3:
            return new AccelerateDecelerateInterpolator();
        case 4:
            return new OvershootInterpolator();
        case 5:
            return new AnticipateInterpolator();
        case 6:
            return new AnticipateOvershootInterpolator();
        case 7:
            return new BounceInterpolator();
        case 8:
            return new FastOutLinearInInterpolator();
        case 9:
            return new LinearInterpolator();
        case 10:
            return new LinearOutSlowInInterpolator();
        default:
            return new FastOutSlowInInterpolator();
    }
}
 
源代码14 项目: AndroidSkinAnimator   文件: TranslationAnimator.java
@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;
}
 
源代码15 项目: Synapse   文件: NeuralModelActivity.java
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();
}
 
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();
    }
 
源代码17 项目: samples   文件: PathProgressDrawable.java
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;
    }
 
源代码18 项目: JPTabBar   文件: RotateAnimater.java
@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();
}
 
源代码19 项目: JPTabBar   文件: JumpAnimater.java
@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();
}
 
源代码20 项目: journaldev   文件: MainActivity.java
private void showAnimation() {
    show = true;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main_animation);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);
}
 
源代码21 项目: journaldev   文件: MainActivity.java
private void revertAnimation() {
    show = false;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);

}
 
源代码22 项目: IndicatorBox   文件: GeneralAnimatorGenerator.java
/**
 * 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;
}
 
源代码23 项目: RadioRealButton   文件: RadioRealButtonGroup.java
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();
    }
}
 
源代码24 项目: FamilyChat   文件: AnimationController.java
private 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);
}
 
源代码25 项目: lunzi   文件: AnimationController.java
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);
}
 
源代码26 项目: ExpandableLayout   文件: Utils.java
/**
 * 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();
    }
}
 
@Override
protected void createTracks() {
    if (getView() != null) {
        createTracks(R.id.dynamicArcView1, new LinearInterpolator(), Color.parseColor("#CC0000"));
        createTracks(R.id.dynamicArcView2, new AnticipateInterpolator(), Color.parseColor("#048482"));
        createTracks(R.id.dynamicArcView3, new AccelerateInterpolator(), Color.parseColor("#003366"));
        createTracks(R.id.dynamicArcView4, new DecelerateInterpolator(), Color.parseColor("#66A7C5"));
        createTracks(R.id.dynamicArcView5, new BounceInterpolator(), Color.parseColor("#FF6000"));
        createTracks(R.id.dynamicArcView6, new OvershootInterpolator(), Color.parseColor("#6F0564"));
    }
}
 
/**
 * Initialized animation properties
 */
private void calculateAnimationProportions() {
    TRANSLATION_Y = sHeight * buttonDistanceY;
    TRANSLATION_X = sWidth * buttonDistanceX;

    anticipation = new AnticipateInterpolator(INTERPOLATOR_WEIGHT);
    overshoot = new OvershootInterpolator(INTERPOLATOR_WEIGHT);
}
 
源代码29 项目: views-widgets-samples   文件: MainActivity.java
/**
 * This method is called to populate the UI according to which interpolator was
 * selected.
 */
private void populateParametersUI(String interpolatorName, LinearLayout parent) {
    parent.removeAllViews();
    try {
        switch (interpolatorName) {
            case "Quadratic Path":
                createQuadraticPathInterpolator(parent);
                break;
            case "Cubic Path":
                createCubicPathInterpolator(parent);
                break;
            case "AccelerateDecelerate":
                mVisualizer.setInterpolator(new AccelerateDecelerateInterpolator());
                break;
            case "Linear":
                mVisualizer.setInterpolator(new LinearInterpolator());
                break;
            case "Bounce":
                mVisualizer.setInterpolator(new BounceInterpolator());
                break;
            case "Accelerate":
                Constructor<AccelerateInterpolator> decelConstructor =
                        AccelerateInterpolator.class.getConstructor(float.class);
                createParamaterizedInterpolator(parent, decelConstructor, "Factor", 1, 5, 1);
                break;
            case "Decelerate":
                Constructor<DecelerateInterpolator> accelConstructor =
                        DecelerateInterpolator.class.getConstructor(float.class);
                createParamaterizedInterpolator(parent, accelConstructor, "Factor", 1, 5, 1);
                break;
            case "Overshoot":
                Constructor<OvershootInterpolator> overshootConstructor =
                        OvershootInterpolator.class.getConstructor(float.class);
                createParamaterizedInterpolator(parent, overshootConstructor, "Tension", 1, 5, 1);
                break;
            case "Anticipate":
                Constructor<AnticipateInterpolator> anticipateConstructor =
                        AnticipateInterpolator.class.getConstructor(float.class);
                createParamaterizedInterpolator(parent, anticipateConstructor, "Tension", 1, 5, 1);
                break;
        }
    } catch (NoSuchMethodException e) {
        Log.e("InterpolatorPlayground", "Error constructing interpolator: " + e);
    }
}
 
源代码30 项目: MusicPlayer   文件: Animation.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animation);
    displaySize = getDisplaySize(this);
    margin = (int) (displaySize.x * 0.1);
    colorList = getColorList();
    root = (LinearLayout) findViewById(R.id.rootZ);
    title = (TextView) findViewById(R.id.titleZ);
    addViews(getInterpolatorList(), null);
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(START_DELAY);

                List<Class> interpolatorClassList = new ArrayList<>();
                interpolatorClassList.add(null);
                interpolatorClassList.add(AccelerateInterpolator.class);
                interpolatorClassList.add(DecelerateInterpolator.class);
                interpolatorClassList.add(OvershootInterpolator.class);
                interpolatorClassList.add(AnticipateInterpolator.class);
                interpolatorClassList.add(AnticipateOvershootInterpolator.class);

                for (Class aClass : interpolatorClassList) {
                    List<Interpolator> interpolatorList = getInterpolatorList(aClass);
                    addViewsOnUI(interpolatorList, aClass);
                    Thread.sleep(ANIMATION_DELAY);
                    startAnimationOnUI(interpolatorList);
                    Thread.sleep(ANIMATION_DELAY + ANIMATION_DURATION);
                    clearAnimationOnUI();
                    Thread.sleep(ANIMATION_DELAY);
                    startAnimationOnUI(interpolatorList);
                    Thread.sleep(ANIMATION_DELAY + ANIMATION_DURATION);
                }

                Thread.sleep(FINISH_DELAY);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        finish();
                    }
                });
            } catch (InterruptedException ignored) {
            }
        }
    }).start();
}