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

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

源代码1 项目: mollyim-android   文件: MicrophoneRecorderView.java
void hide() {
  recordButtonFab.setTranslationX(0);
  recordButtonFab.setTranslationY(0);
  if (recordButtonFab.getVisibility() != VISIBLE) return;

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, lastOffsetX,
                                                        Animation.ABSOLUTE, 0,
                                                        Animation.ABSOLUTE, lastOffsetY,
                                                        Animation.ABSOLUTE, 0);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
源代码2 项目: indigenous-android   文件: EditImageActivity.java
void showFilter(boolean isVisible) {
    mIsFilterVisible = isVisible;
    mConstraintSet.clone(mRootView);

    if (isVisible) {
        mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.START);
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START,
                ConstraintSet.PARENT_ID, ConstraintSet.START);
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.END,
                ConstraintSet.PARENT_ID, ConstraintSet.END);
    } else {
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START,
                ConstraintSet.PARENT_ID, ConstraintSet.END);
        mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.END);
    }

    ChangeBounds changeBounds = new ChangeBounds();
    changeBounds.setDuration(350);
    changeBounds.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
    TransitionManager.beginDelayedTransition(mRootView, changeBounds);

    mConstraintSet.applyTo(mRootView);
}
 
源代码3 项目: PhotoEditor   文件: EditImageActivity.java
void showFilter(boolean isVisible) {
    mIsFilterVisible = isVisible;
    mConstraintSet.clone(mRootView);

    if (isVisible) {
        mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.START);
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START,
                ConstraintSet.PARENT_ID, ConstraintSet.START);
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.END,
                ConstraintSet.PARENT_ID, ConstraintSet.END);
    } else {
        mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START,
                ConstraintSet.PARENT_ID, ConstraintSet.END);
        mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.END);
    }

    ChangeBounds changeBounds = new ChangeBounds();
    changeBounds.setDuration(350);
    changeBounds.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
    TransitionManager.beginDelayedTransition(mRootView, changeBounds);

    mConstraintSet.applyTo(mRootView);
}
 
源代码4 项目: timecat   文件: PreSettingActivity.java
private void animationThree() {

        controlByFloat.setVisibility(View.VISIBLE);
        controlByNotify.setVisibility(View.VISIBLE);
        triggerByFloat.setVisibility(View.VISIBLE);
        confirmSetting.setVisibility(View.VISIBLE);

        controlByFloat.setScaleX(0.5f);
        controlByFloat.setScaleY(0.5f);

        controlByNotify.setScaleX(0.5f);
        controlByNotify.setScaleY(0.5f);

        triggerByFloat.setScaleX(0.5f);
        triggerByFloat.setScaleY(0.5f);

        confirmSetting.setScaleX(0.5f);
        confirmSetting.setScaleY(0.5f);

        controlByFloat.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
        controlByNotify.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
        triggerByFloat.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
        confirmSetting.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
    }
 
源代码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 项目: 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();
    }
}
 
源代码7 项目: Reachability   文件: CustomAnimationActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_animation);

    ImageView view = new ImageView(this);
    view.setBackgroundResource(R.drawable.custom_button_selector);
    view.setScaleType(ImageView.ScaleType.CENTER);

    mReachability = new Reachability(this);
    mReachability.canTouchableBackView(true);
    mReachability.setBackImageResource(R.drawable.tiles);
    // Should call before makeHoverView!
    mReachability.setHoverView(view, android.R.drawable.ic_partial_secure, android.R.drawable.ic_secure);
    mReachability.makeHoverView(Reachability.Position.CENTER);
    mReachability.setCustomSlideInAnimation(1000, new AnticipateOvershootInterpolator(), fromLeftAnimation());
    mReachability.setCustomSlideOutAnimation(1000, new AnticipateOvershootInterpolator(), toRightAnimation());

    findViewById(R.id.switch_hover).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mReachability.switchHover();
        }
    });
}
 
源代码8 项目: UTubeTV   文件: StandardAnimations.java
public static void rockBounce(final View theView) {
  theView.animate()
      .rotationXBy(30.0f)
      .setDuration(200)
      .setInterpolator(new AnticipateOvershootInterpolator())
      .withEndAction(new Runnable() {
        @Override
        public void run() {
          theView.animate()
              .setDuration(100)
              .rotationX(0)
              .setInterpolator(new AnticipateOvershootInterpolator())
              .start();
        }
      });
}
 
源代码9 项目: bcm-android   文件: VoiceRecodingPanel.java
private void hide(float x) {
    this.lastPositionX = x;

    float offset = getOffset(x);
    int widthAdjustment = getWidthAdjustment();

    AnimationSet animation = new AnimationSet(false);
    Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);

    Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
            Animation.ABSOLUTE, widthAdjustment,
            Animation.RELATIVE_TO_SELF, -.25f,
            Animation.RELATIVE_TO_SELF, -.25f);

    scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
    translateAnimation.setInterpolator(new DecelerateInterpolator());
    animation.addAnimation(scaleAnimation);
    animation.addAnimation(translateAnimation);
    animation.setDuration(ANIMATION_DURATION);
    animation.setFillBefore(true);
    animation.setFillAfter(false);
    animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

    recordButtonFab.setVisibility(View.GONE);
    recordButtonFab.clearAnimation();
    recordButtonFab.startAnimation(animation);
}
 
源代码10 项目: 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();
    }
}
 
源代码11 项目: timecat   文件: IntroActivity.java
private void showEnterBtn() {
    if (clickTimes >= 5 || SPHelper.getBoolean(KEY, false) || SPHelper.getBoolean(INTRODUCED, false)) {
        if (mEnterBtn.getVisibility() != View.VISIBLE) {
            mEnterBtn.setVisibility(View.VISIBLE);
            mEnterBtn.setScaleY(0);
            mEnterBtn.setScaleX(0);
            mEnterBtn.setAlpha(0);
            mEnterBtn.animate().scaleX(1).scaleY(1).alpha(1).setInterpolator(new AnticipateOvershootInterpolator()).setStartDelay(500).start();
        }
    }
}
 
源代码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 项目: android   文件: BaseCircle.java
public void animateIndicator(float indicator) {
    Interpolator interpolator = new AnticipateOvershootInterpolator(1.8f);
    ObjectAnimator animation = ObjectAnimator.ofFloat(this, "indicator", indicator);
    animation.setDuration(2000);
    animation.setInterpolator(interpolator);
    animation.start();
}
 
源代码15 项目: android   文件: LineIndicator.java
public void animateIndicator(float progress) {
    Interpolator interpolator = new AnticipateOvershootInterpolator(1.8f);
    ObjectAnimator animation = ObjectAnimator.ofFloat(this, "progress", progress);
    animation.setDuration(3000);
    animation.setInterpolator(interpolator);
    animation.start();
}
 
源代码16 项目: TinderStack   文件: TinderStackLayout.java
public void addCard(TinderCardView tc){
    ViewGroup.LayoutParams layoutParams; layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    int childCount = getChildCount();
    addView(tc, 0, layoutParams);

    float scaleValue = 1 - (childCount/50.0f);

    tc.animate()
        .x(0)
        .y(childCount * yMultiplier)
        .scaleX(scaleValue)
        .setInterpolator(new AnticipateOvershootInterpolator())
        .setDuration(DURATION);
}
 
源代码17 项目: BigApp_Discuz_Android   文件: PasswActivity.java
/**
 * Initializes wheel
 * @param id the wheel widget Id
 */
private void initWheel(int id) {
    WheelView wheel = getWheel(id);
    wheel.setViewAdapter(new NumericWheelAdapter(this, 0, 9));
    wheel.setCurrentItem((int)(Math.random() * 10));
    
    wheel.addChangingListener(changedListener);
    wheel.addScrollingListener(scrolledListener);
    wheel.setCyclic(true);
    wheel.setInterpolator(new AnticipateOvershootInterpolator());
}
 
源代码18 项目: 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();
    }
}
 
源代码19 项目: deltachat-android   文件: MicrophoneRecorderView.java
public void hide(float x) {
  this.lastPositionX = x;

  float offset = getOffset(x);

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset,
                                                        Animation.ABSOLUTE, 0,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
源代码20 项目: 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);
}
 
源代码21 项目: 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);
}
 
源代码22 项目: 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();
    }
}
 
源代码23 项目: FlexibleAdapter   文件: SlideItemAnimator.java
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    return ViewCompat.animate(view)
                     .translationX(Utils.getScreenDimensions(holder.itemView.getContext()).x)
                     .setInterpolator(new AnticipateOvershootInterpolator());
}
 
源代码24 项目: RecyclerViewLib   文件: SlideItemAnimator.java
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    return ViewCompat.animate(view)
            .translationX(DisplayUtils.getScreenDimensions(holder.itemView.getContext()).x)
            .setInterpolator(new AnticipateOvershootInterpolator());
}
 
源代码25 项目: UTubeTV   文件: StandardAnimations.java
public static void rubberClick(final View theView) {
  ObjectAnimator rotateAnim = ObjectAnimator.ofFloat(theView, "rotationY", 60f);
  ObjectAnimator rotateBack = ObjectAnimator.ofFloat(theView, "rotationY", 0f);
  ObjectAnimator scaleXDown = ObjectAnimator.ofFloat(theView, "scaleX", .4f);
  ObjectAnimator scaleYDown = ObjectAnimator.ofFloat(theView, "scaleY", .4f);
  ObjectAnimator scaleXBack = ObjectAnimator.ofFloat(theView, "scaleX", 1f);
  ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(theView, "scaleY", 1f);

  AnimatorSet bouncer = new AnimatorSet();
  bouncer.setInterpolator(new AnticipateOvershootInterpolator());
  bouncer.play(scaleXDown).with(scaleYDown);
  bouncer.play(scaleXBack).with(scaleYBack);
  bouncer.play(scaleXBack).after(scaleXDown);
  bouncer.play(rotateAnim).after(scaleXBack);
  bouncer.play(rotateBack).after(rotateAnim);

  ObjectAnimator fadeOut = ObjectAnimator.ofFloat(theView, "alpha", 0f);
  ObjectAnimator fadeBack = ObjectAnimator.ofFloat(theView, "alpha", 1f);
  fadeOut.setDuration(250);
  fadeBack.setDuration(250);
  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.play(bouncer).before(fadeOut);
  animatorSet.play(fadeBack).after(fadeOut);
  animatorSet.start();

  //    theView.animate().scaleX(.8f).scaleY(.8f).setDuration(200).setInterpolator(new AnticipateOvershootInterpolator()).withEndAction(new Runnable() {
  //      @Override
  //      public void run() {
  //        theView.animate().setDuration(100).scaleX(1.0f).scaleY(1.0f).setInterpolator(new AnticipateOvershootInterpolator()).start();
  //      }
  //    });
}
 
源代码26 项目: UTubeTV   文件: DonateThanksHelper.java
private void animateV(final View theView, int offsetX, int offsetY) {
  float randomScale = 1.2f + (float) (Math.random() * 3.0f);
  float randomScaleBack = .9f + (float) (Math.random() * .8f);

  ObjectAnimator scaleXDown = ObjectAnimator.ofFloat(theView, "scaleX", randomScale);
  ObjectAnimator scaleYDown = ObjectAnimator.ofFloat(theView, "scaleY", randomScale);
  ObjectAnimator scaleXBack = ObjectAnimator.ofFloat(theView, "scaleX", randomScaleBack);
  ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(theView, "scaleY", randomScaleBack);

  float alphav = .7f + (float) (Math.random() * .3f);

  ObjectAnimator alpha = ObjectAnimator.ofFloat(theView, "alpha", alphav);

  long startDelay = (long) (Math.random() * 2000);

  AnimatorSet bouncer = new AnimatorSet();
  bouncer.setInterpolator(new AnticipateOvershootInterpolator());
  bouncer.setStartDelay(startDelay);
  bouncer.play(scaleXDown).with(scaleYDown).with(alpha);
  bouncer.play(scaleXBack).with(scaleYBack);
  bouncer.play(scaleXBack).after(scaleXDown);

  ObjectAnimator transitionX = ObjectAnimator.ofFloat(theView, "translationX", mDisplaySize.x / 2);
  ObjectAnimator transitionY = ObjectAnimator.ofFloat(theView, "translationY", mDisplaySize.y + 100);

  AnimatorSet moveOffSet = new AnimatorSet();
  moveOffSet.setStartDelay(2000);
  moveOffSet.setDuration(200);
  moveOffSet.setInterpolator(new AnticipateOvershootInterpolator());
  moveOffSet.play(transitionX).with(transitionY);

  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.play(moveOffSet).after(bouncer);
  animatorSet.start();
}
 
源代码27 项目: 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();
}
 
源代码28 项目: TinderStack   文件: TinderStackLayout.java
private void setUpRxBusSubscription(){
        Subscription rxBusSubscription = RxBus.getInstance().toObserverable()
                .observeOn(AndroidSchedulers.mainThread()) // UI Thread
                .subscribe(new Action1<Object>() {
                    @Override
                    public void call(Object event) {
                        if (event == null) {
                            return;
                        }

                        if(event instanceof TopCardMovedEvent){
                            float posX = ((TopCardMovedEvent) event).getPosX();

                            int childCount = getChildCount();
                            for(int i=childCount-2; i>=0; i--){
                                TinderCardView tinderCardView = (TinderCardView) getChildAt(i);

                                if(tinderCardView != null){
                                    if(Math.abs(posX) == (float)screenWidth){
                                        float scaleValue = 1 - ((childCount-2-i)/50.0f);

                                        tinderCardView.animate()
                                            .x(0)
                                            .y((childCount-2-i) * yMultiplier)
                                            .scaleX(scaleValue)
                                            .rotation(0)
                                            .setInterpolator(new AnticipateOvershootInterpolator())
                                            .setDuration(DURATION);
                                    } else {
//                                        float multiplier =  (DisplayUtility.dp2px(getContext(), 8)) / (float)screenWidth;
//                                        float dy = -(Math.abs(posX * multiplier));
//                                        tinderCard.setTranslationY(dy);
                                    }
                                }
                            }
                        }
                    }
                });

        compositeSubscription.add(rxBusSubscription);
    }
 
源代码29 项目: proteus   文件: AnimationUtils.java
Interpolator createInterpolator(Context c) {
  return null == tension ? new AnticipateOvershootInterpolator() : (null == extraTension ? new AnticipateOvershootInterpolator(tension) : new AnticipateOvershootInterpolator(tension, extraTension));
}