android.view.animation.AnticipateOvershootInterpolator Java Examples

The following examples show how to use android.view.animation.AnticipateOvershootInterpolator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MicrophoneRecorderView.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: EditImageActivity.java    From indigenous-android with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: EditImageActivity.java    From PhotoEditor with MIT License 6 votes vote down vote up
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);
}
 
Example #4
Source File: StandardAnimations.java    From UTubeTV with The Unlicense 6 votes vote down vote up
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();
        }
      });
}
 
Example #5
Source File: PreSettingActivity.java    From timecat with Apache License 2.0 6 votes vote down vote up
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();
    }
 
Example #6
Source File: CustomAnimationActivity.java    From Reachability with Apache License 2.0 6 votes vote down vote up
@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();
        }
    });
}
 
Example #7
Source File: InterpolatorSelector.java    From ParallaxEverywhere with MIT License 6 votes vote down vote up
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();
    }
}
 
Example #8
Source File: SegmentedButtonGroup.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #9
Source File: DonateThanksHelper.java    From UTubeTV with The Unlicense 5 votes vote down vote up
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();
}
 
Example #10
Source File: StandardAnimations.java    From UTubeTV with The Unlicense 5 votes vote down vote up
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();
  //      }
  //    });
}
 
Example #11
Source File: SlideItemAnimator.java    From RecyclerViewLib with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #12
Source File: SlideItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #13
Source File: Utils.java    From ExpandableLayout with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example #14
Source File: AnimationController.java    From lunzi with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #15
Source File: AnimationController.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #16
Source File: MicrophoneRecorderView.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #17
Source File: RadioRealButtonGroup.java    From RadioRealButton with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example #18
Source File: PasswActivity.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #19
Source File: TinderStackLayout.java    From TinderStack with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #20
Source File: LineIndicator.java    From android with MIT License 5 votes vote down vote up
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();
}
 
Example #21
Source File: BaseCircle.java    From android with MIT License 5 votes vote down vote up
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();
}
 
Example #22
Source File: Animation.java    From MusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@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();
    }
}
 
Example #23
Source File: Animation.java    From MusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: IntroActivity.java    From timecat with Apache License 2.0 5 votes vote down vote up
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();
        }
    }
}
 
Example #25
Source File: UDInterpolator.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
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();
    }
}
 
Example #26
Source File: VoiceRecodingPanel.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #27
Source File: TinderStackLayout.java    From TinderStack with Apache License 2.0 4 votes vote down vote up
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);
    }
 
Example #28
Source File: Animation.java    From MusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
@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();
}
 
Example #29
Source File: AnimationUtils.java    From proteus with Apache License 2.0 4 votes vote down vote up
Interpolator createInterpolator(Context c) {
  return null == tension ? new AnticipateOvershootInterpolator() : (null == extraTension ? new AnticipateOvershootInterpolator(tension) : new AnticipateOvershootInterpolator(tension, extraTension));
}