Java Code Examples for android.view.animation.AnticipateOvershootInterpolator

The following are top voted examples for showing how to use android.view.animation.AnticipateOvershootInterpolator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Bigbang   File: PreSettingActivity.java   View source code 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 2
Project: SegmentedButton   File: SegmentedButtonGroup.java   View source code 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 3
Project: CardsView   File: CardGroup.java   View source code 6 votes vote down vote up
/**
 * 重置第一张卡片
 */
private void makeFirstViewReset() {
    CardView firstSlideView = getFirstSlideView();
    firstSlideView.resetRotateType();
    float rotate = firstSlideView.getCardRotation();
    int startX = firstSlideView.getScrollX();
    int startY = firstSlideView.getScrollY();

    ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
    animator.setTarget(firstSlideView);
    animator.setDuration(ANIM_DURATION);
    animator.setInterpolator(new AnticipateOvershootInterpolator());
    animator.addUpdateListener((animation) -> {
        float curRate = (float) animation.getAnimatedValue();
        firstSlideView.scrollTo((int) (startX * curRate), (int) (startY * curRate));
        firstSlideView.setReleaseRotation(curRate * rotate);
    });

    animator.start();
}
 
Example 4
Project: CardsView   File: CardGroup.java   View source code 6 votes vote down vote up
/**
 * 第一张卡片滑出时,剩余卡片上浮
 * @param position
 */
private void makeUnderViewReplace(int position) {
    CardView underSlideView = slideViewMap.get(position);

    if (underSlideView != null) {
        ValueAnimator animator = ValueAnimator.ofFloat(percent, 1);
        animator.setTarget(underSlideView);
        animator.setDuration(ANIM_DURATION);
        animator.setInterpolator(new AnticipateOvershootInterpolator());
        animator.addUpdateListener(animation -> {
            float curPercent = (float) animation.getAnimatedValue();
            makeUnderViewInvalidate(position, curPercent);
        });

        animator.start();
    }
}
 
Example 5
Project: anime-android-go-99   File: AmplitudesFragment.java   View source code 6 votes vote down vote up
private void hideInitialCallToAction() {
    animatorFor(generateData, getAnimatorContext())
            .withInterpolator(new AnticipateOvershootInterpolator())
            .alpha(0f)
            .scale(0f)
            .addOnAnimationCompleted(new OnAnimationCompleted() {
                @Override
                public void onAnimationCompleted(boolean finished) {
                    if (finished) {
                        generateData.setVisibility(View.INVISIBLE);
                        generateData.setScaleX(1f);
                        generateData.setScaleY(1f);
                        generateData.setAlpha(1f);
                    }
                }
            })
            .start();
}
 
Example 6
Project: anime-android-go-99   File: AmplitudesFragment.java   View source code 6 votes vote down vote up
private void showGenerateData() {
    animatorFor(generateData, getAnimatorContext())
            .withInterpolator(new AnticipateOvershootInterpolator())
            .addOnAnimationWillStart(new MultiAnimator.WillRunListener() {
                @Override
                public void onMultiAnimatorWillRun(@NonNull MultiAnimator animator) {
                    generateData.setAlpha(0f);
                    generateData.setScaleX(0f);
                    generateData.setScaleY(0f);
                    generateData.setVisibility(View.VISIBLE);
                }
            })
            .alpha(1f)
            .scale(1f)
            .start();
}
 
Example 7
Project: itsnat_droid   File: ClassDescInterpolatorAnticipateOvershoot.java   View source code 6 votes vote down vote up
public void fillResourceAttributes(AnticipateOvershootInterpolator interpolator, DOMElement domElement, AttrInterpolatorContext attrCtx)
{
    XMLInflaterResource xmlInflaterInterpolator = attrCtx.getXMLInflaterResource();
    XMLInflaterRegistry xmlInflaterRegistry = xmlInflaterInterpolator.getInflatedXMLResource().getXMLInflaterRegistry();

    DOMAttr attrTension = domElement.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "tension");
    float tension = attrTension != null ? xmlInflaterRegistry.getFloat(attrTension.getResourceDesc(),attrCtx.getXMLInflaterContext()) : 2.0f;

    DOMAttr attrExtraTension = domElement.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "extraTension");
    float extraTension = attrExtraTension != null ? xmlInflaterRegistry.getFloat(attrExtraTension.getResourceDesc(),attrCtx.getXMLInflaterContext()) : 1.5f;

    float totalTension = tension * extraTension;

    fieldMTension.set(interpolator,totalTension);

    super.fillResourceAttributes(interpolator,domElement,attrCtx);
}
 
Example 8
Project: Reachability   File: CustomAnimationActivity.java   View source code 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 9
Project: UTubeTV   File: StandardAnimations.java   View source code 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 10
Project: GitHub   File: SlideItemAnimator.java   View source code 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 11
Project: PeSanKita-android   File: MicrophoneRecorderView.java   View source code 5 votes vote down vote up
public 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 12
Project: LuaViewPlayground   File: UDInterpolator.java   View source code 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();
                //暂时不支持的
//            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();
        }
    }
 
Example 13
Project: Farmacias   File: Utils.java   View source code 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
Project: Hotspot-master-devp   File: AnimationUtil.java   View source code 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
Project: pipe   File: MainActivity.java   View source code 5 votes vote down vote up
/**
 * NavHelper处理后,回调的方法
 * @param newTab 新的Tab
 * @param oldTab 旧的Tab
 */
@Override
public void onTabChanged(NavHelper.Tab<Integer> newTab, NavHelper.Tab<Integer> oldTab) {
    // 从额外字段中取出我们的Title资源Id
    title.setText(newTab.extra);

    // 对FloatButton进行隐藏和显示动画
    float transY = 0;
    float rotation = 0;
    // 判断所处界面
    if (Objects.equals(newTab.extra, R.string.title_home)) {
        transY = Ui.dipToPx(getResources(), 76);
    } else {

        // 此时Y默认为0===显示fb
        if (Objects.equals(newTab.extra, R.string.title_group)) {
            floatbutton.setImageResource(R.drawable.ic_group_add);
            rotation = -360;
        } else {
            // 联系人
            floatbutton.setImageResource(R.drawable.ic_contact_add);
            rotation = 360;
        }
    }

    // 开始动画,旋转,Y轴惟一,弹性
    floatbutton.animate()
            .rotation(rotation)
            .setInterpolator(new AnticipateOvershootInterpolator(1))
            .translationY(transY)
            .setDuration(480)
            .start();
}
 
Example 16
Project: Bigbang   File: IntroActivity.java   View source code 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 17
Project: OSchina_resources_android   File: UserSelectFriendsActivity.java   View source code 5 votes vote down vote up
private void transLabelX(boolean show) {
    if (labelHideTransX == -1)
        labelHideTransX = TDevice.dipToPx(getResources(), 52);

    if (show) {
        if (labelBeforeTransX == 0)
            return;
        else
            labelBeforeTransX = 0;
    } else {
        if (labelBeforeTransX == labelHideTransX)
            return;
        else
            labelBeforeTransX = labelHideTransX;
    }

    if (mTvLabel.getTag() == null) {
        mTvLabel.animate()
                .setInterpolator(new AnticipateOvershootInterpolator(2.5f))
                .setDuration(260);
        mTvLabel.setTag(mTvLabel.animate());
    }

    mTvLabel.animate()
            .translationXBy(mTvLabel.getTranslationX())
            .translationX(labelBeforeTransX)
            .start();
}
 
Example 18
Project: boohee_v5.6   File: BaseCircle.java   View source code 5 votes vote down vote up
public void animateIndicator(float indicator) {
    Interpolator interpolator = new AnticipateOvershootInterpolator(1.8f);
    ObjectAnimator animation = ObjectAnimator.ofFloat(this, "indicator", new
            float[]{indicator});
    animation.setDuration(2000);
    animation.setInterpolator(interpolator);
    animation.start();
}
 
Example 19
Project: boohee_v5.6   File: LineIndicator.java   View source code 5 votes vote down vote up
public void animateIndicator(float progress) {
    Interpolator interpolator = new AnticipateOvershootInterpolator(1.8f);
    ObjectAnimator animation = ObjectAnimator.ofFloat(this, "progress", new float[]{progress});
    animation.setDuration(3000);
    animation.setInterpolator(interpolator);
    animation.start();
}
 
Example 20
Project: Cable-Android   File: MicrophoneRecorderView.java   View source code 5 votes vote down vote up
public 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 21
Project: Tab_Navigator   File: Utils.java   View source code 5 votes vote down vote up
/**
 * 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();
  }
}
 
Example 22
Project: MaterialList   File: DetailActivity.java   View source code 5 votes vote down vote up
private void animateFAB(boolean start, View fab)
{
    ViewCompat.animate(fab)
        .scaleX(start ? 1.0f : 0.0f)
        .scaleY(start ? 1.0f : 0.0f)
        .alpha(start ? 1.0f : 0.0f)
        .setDuration(start ? 300 : 100)
        .setInterpolator(new AnticipateOvershootInterpolator())
        .withLayer()
        .start();
}
 
Example 23
Project: TinderStack   File: TinderStackLayout.java   View source code 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 24
Project: BigApp_Discuz_Android   File: PasswActivity.java   View source code 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 25
Project: CardsView   File: CardGroup.java   View source code 5 votes vote down vote up
/**
 * 重置下面的卡片
 * @param position
 */
private void makeUnderViewReset(int position) {
    CardView underSlideView = slideViewMap.get(position);

    if (underSlideView != null) {
        int topMargin = (int) underSlideView.getTag(R.id.card_margin_top);
        float scale = (float) underSlideView.getTag(R.id.card_scale);
        int topPadding = underSlideView.getPaddingTop();
        float curScale = underSlideView.getScaleX();

        ValueAnimator paddingAnimator = ValueAnimator.ofInt(topPadding, topMargin);
        paddingAnimator.setTarget(underSlideView);
        paddingAnimator.setDuration(ANIM_DURATION);
        paddingAnimator.setInterpolator(new AnticipateOvershootInterpolator());
        paddingAnimator.addUpdateListener((animation) -> {
            int padding = (int) animation.getAnimatedValue();
            underSlideView.setPadding(0, padding, 0, 0);
        });

        ValueAnimator scaleAnimator = ValueAnimator.ofFloat(curScale, scale);
        scaleAnimator.setTarget(underSlideView);
        scaleAnimator.setDuration(ANIM_DURATION);
        scaleAnimator.setInterpolator(new AnticipateOvershootInterpolator());
        scaleAnimator.addUpdateListener(animation -> {
            float valueScale = (float) animation.getAnimatedValue();
            underSlideView.setScaleX(valueScale);
        });

        paddingAnimator.start();
        scaleAnimator.start();
    }
}
 
Example 26
Project: media   File: MainFragment.java   View source code 5 votes vote down vote up
@Override
protected void animatePreviewViewDuringCameraTypeToggle(@NonNull ViewPropertyAnimator animator) {
  animator.rotationYBy(360)
      .setDuration(1500)
      .setInterpolator(new AnticipateOvershootInterpolator())
      .start();
}
 
Example 27
Project: AyoSunny   File: AnimationController.java   View source code 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 28
Project: RadioRealButton   File: RadioRealButtonGroup.java   View source code 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 29
Project: lunzi   File: AnimationController.java   View source code 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 30
Project: XProgressDialog   File: HeartProgressView.java   View source code 5 votes vote down vote up
public void start() {
    this.isStopped = false;

    leftHeartX = width / 4 + width / 8;
    leftHeartY = height / 4 + height / 8;

    PropertyValuesHolder widthPropertyHolder = PropertyValuesHolder.ofFloat(POSITION_X, width / 4 + width / 8, width / 2 + width / 8);
    PropertyValuesHolder heightPropertyHolder = PropertyValuesHolder.ofFloat(POSITION_Y, height / 4 + height / 8, height / 2 + height / 8);
    animatorLeftHeart = ValueAnimator.ofPropertyValuesHolder(widthPropertyHolder, heightPropertyHolder);
    animatorLeftHeart.setDuration(2000);
    animatorLeftHeart.setStartDelay(1000);
    animatorLeftHeart.setInterpolator(new AnticipateOvershootInterpolator());
    animatorLeftHeart.addUpdateListener(leftHeartAnimationUpdateListener);
    animatorLeftHeart.setRepeatMode(ValueAnimator.REVERSE);
    animatorLeftHeart.setRepeatCount(ValueAnimator.INFINITE);

    widthPropertyHolder = PropertyValuesHolder.ofFloat(POSITION_X, width / 2 + width / 8, width / 4 + width / 8);
    heightPropertyHolder = PropertyValuesHolder.ofFloat(POSITION_Y, height / 4 + height / 8, height / 2 + height / 8);
    animatorRightHeart = ValueAnimator.ofPropertyValuesHolder(widthPropertyHolder, heightPropertyHolder);
    animatorRightHeart.setDuration(2000);
    animatorRightHeart.setInterpolator(new AnticipateOvershootInterpolator());
    animatorRightHeart.addUpdateListener(rightHeartAnimationUpdateListener);
    animatorRightHeart.setRepeatCount(ValueAnimator.INFINITE);
    animatorRightHeart.setRepeatMode(ValueAnimator.REVERSE);

    animatorRightHeart.start();
    animatorLeftHeart.start();

    invalidate();
}
 
Example 31
Project: itsnat_droid   File: ClassDescInterpolatorAnticipateOvershoot.java   View source code 5 votes vote down vote up
@Override
public boolean isAttributeIgnored(AnticipateOvershootInterpolator resource, String namespaceURI, String name)
{
    if (super.isAttributeIgnored(resource,namespaceURI,name))
        return true;
    return NamespaceUtil.XMLNS_ANDROID.equals(namespaceURI) && (name.equals("tension") || name.equals("extraTension"));
}
 
Example 32
Project: itsnat_droid   File: TestSetupAssetLayoutAnimations2.java   View source code 5 votes vote down vote up
private static void initInterpolatorAnticipateOvershootTest(TestActivity act, View rootView,InflatedLayout layout)
{
    TextView textView = getTextView(rootView,R.id.antOverInterpolatorTestId1);
    Animation animation = getAnimation(act,layout);

    AnticipateOvershootInterpolator interpolator = (AnticipateOvershootInterpolator)getInterpolator(
            R.anim.test_interpolator_anticipateovershoot_compiled,
            "@assets:anim/res/anim/test_interpolator_anticipateovershoot_asset.xml",act,layout);

    animation.setInterpolator(interpolator);
    textView.startAnimation(animation);

    Assert.assertEquals((Float)TestUtil.getField(interpolator,AnticipateOvershootInterpolator.class,"mTension"),3.0f * 2.0f);
}
 
Example 33
Project: FlexibleAdapter   File: SlideItemAnimator.java   View source code 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 34
Project: Stacks-Flashcards   File: UndoBarController.java   View source code 5 votes vote down vote up
private static Animation outToBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2,
            0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(500L);
    translateanimation.setInterpolator(new AnticipateOvershootInterpolator(
            1.0f));
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}
 
Example 35
Project: SimpleAppLock   File: UndoBarController.java   View source code 5 votes vote down vote up
private static Animation outToBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2,
            0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(500L);
    translateanimation.setInterpolator(new AnticipateOvershootInterpolator(
            1.0f));
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}
 
Example 36
Project: itheima   File: AnimationController.java   View source code 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 37
Project: itheima   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	imageView = (ImageView) findViewById(R.id.imageView1);

	btn01 = (Button) findViewById(R.id.button1);
	btn01.setOnClickListener(new MyOnClickListener(InterpolatorType.Accelerate));
	
	btn02 = (Button) findViewById(R.id.button2);
	btn02.setOnClickListener(new MyOnClickListener(InterpolatorType.Decelerate));
	
	btn03 = (Button) findViewById(R.id.button3);
	btn03.setOnClickListener(new MyOnClickListener(InterpolatorType.AccelerateDecelerate));
	
	btn04 = (Button) findViewById(R.id.button4);
	btn04.setOnClickListener(new MyOnClickListener(InterpolatorType.LinearInterpolator));
	
	btn05 = (Button) findViewById(R.id.button5);
	btn05.setOnClickListener(new MyOnClickListener(InterpolatorType.BounceInterpolator));
	
	btn06 = (Button) findViewById(R.id.button6);
	btn06.setOnClickListener(new MyOnClickListener(InterpolatorType.AnticipateInterpolator));
	
	btn07 = (Button) findViewById(R.id.button7);
	btn07.setOnClickListener(new MyOnClickListener(InterpolatorType.AnticipateOvershootInterpolator));
	
	btn08 = (Button) findViewById(R.id.button8);
	btn08.setOnClickListener(new MyOnClickListener(InterpolatorType.CycleInterpolator));
	
	btn09 = (Button) findViewById(R.id.button9);
	btn09.setOnClickListener(new MyOnClickListener(InterpolatorType.OvershootInterpolator));
}
 
Example 38
Project: RecyclerViewLib   File: SlideItemAnimator.java   View source code 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 39
Project: tzPalette   File: ColorRow.java   View source code 5 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent)
{
    View cellView;
    ColorCell colorView;
    
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    cellView = inflater.inflate(R.layout.color_item, parent, false);
    
    if (animFadeInViewWhenAddNew && mNewlyAddedPosition == position)
    {
        cellView.setAlpha(0);
        cellView.setScaleX(.2f);
        cellView.setScaleY(.2f);
        cellView.animate().setInterpolator(new AnticipateOvershootInterpolator()).alpha(1).scaleX(1).scaleY(1).start();
        
        mNewlyAddedPosition = -1;
    }
    
    int cellSize = parent.getHeight();
    
    cellView.setMinimumHeight(cellSize);
    cellView.setMinimumWidth(cellSize);
    
    if (mCurSel == position)
    {
        cellView.setScaleX(1.2f);
        cellView.setScaleY(1.2f);
    }
    
    colorView = (ColorCell)cellView.findViewById(R.id.item_color);
    colorView.setMinimumHeight(cellSize - cellView.getPaddingTop() - cellView.getPaddingBottom());
    colorView.setMinimumWidth(cellSize - cellView.getPaddingLeft() - cellView.getPaddingRight());
    colorView.setColor(mColors.get(position));
    
    return cellView;
}
 
Example 40
Project: UTubeTV   File: StandardAnimations.java   View source code 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();
  //      }
  //    });
}