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

PreSettingActivity.java 文件源码 项目:Bigbang 阅读 22 收藏 0 点赞 0 评论 0
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();
    }
SegmentedButtonGroup.java 文件源码 项目:SegmentedButton 阅读 33 收藏 0 点赞 0 评论 0
private void initInterpolations() {
    ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
        add(FastOutSlowInInterpolator.class);
        add(BounceInterpolator.class);
        add(LinearInterpolator.class);
        add(DecelerateInterpolator.class);
        add(CycleInterpolator.class);
        add(AnticipateInterpolator.class);
        add(AccelerateDecelerateInterpolator.class);
        add(AccelerateInterpolator.class);
        add(AnticipateOvershootInterpolator.class);
        add(FastOutLinearInInterpolator.class);
        add(LinearOutSlowInInterpolator.class);
        add(OvershootInterpolator.class);
    }};

    try {
        interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
CardGroup.java 文件源码 项目:CardsView 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 重置第一张卡片
 */
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();
}
CardGroup.java 文件源码 项目:CardsView 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 第一张卡片滑出时,剩余卡片上浮
 * @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();
    }
}
AmplitudesFragment.java 文件源码 项目:anime-android-go-99 阅读 26 收藏 0 点赞 0 评论 0
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();
}
AmplitudesFragment.java 文件源码 项目:anime-android-go-99 阅读 24 收藏 0 点赞 0 评论 0
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();
}
ClassDescInterpolatorAnticipateOvershoot.java 文件源码 项目:itsnat_droid 阅读 26 收藏 0 点赞 0 评论 0
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);
}
CustomAnimationActivity.java 文件源码 项目:Reachability 阅读 23 收藏 0 点赞 0 评论 0
@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();
        }
    });
}
StandardAnimations.java 文件源码 项目:UTubeTV 阅读 22 收藏 0 点赞 0 评论 0
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();
        }
      });
}
SlideItemAnimator.java 文件源码 项目:GitHub 阅读 28 收藏 0 点赞 0 评论 0
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());
}
MicrophoneRecorderView.java 文件源码 项目:PeSanKita-android 阅读 33 收藏 0 点赞 0 评论 0
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);
}
UDInterpolator.java 文件源码 项目:LuaViewPlayground 阅读 37 收藏 0 点赞 0 评论 0
public static Interpolator parse(Integer type, Float cycles) {
        if (type != null) {
            switch (type) {
                case 0:
                    return new AccelerateDecelerateInterpolator();
                case 1:
                    return new AccelerateInterpolator();
                case 2:
                    return new AnticipateInterpolator();
                case 3:
                    return new AnticipateOvershootInterpolator();
                case 4:
                    return new BounceInterpolator();
                case 5:
                    return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
                case 6:
                    return new DecelerateInterpolator();
                case 7:
                    return new LinearInterpolator();
                case 8:
                    return new OvershootInterpolator();
                //暂时不支持的
//            case 7: return new FastOutLinearInterplator();
//            case 8: return new FastOutSlowInInterplator();
//            case 10: return new LinearOutSlowInInterplator();
//            case 12: return new PathInterplator();
                default:
                    return new LinearInterpolator();
            }
        } else {
            return new LinearInterpolator();
        }
    }
Utils.java 文件源码 项目:Farmacias 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Creates interpolator.
 *
 * @param interpolatorType
 * @return
 */
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
    switch (interpolatorType) {
        case ACCELERATE_DECELERATE_INTERPOLATOR:
            return new AccelerateDecelerateInterpolator();
        case ACCELERATE_INTERPOLATOR:
            return new AccelerateInterpolator();
        case ANTICIPATE_INTERPOLATOR:
            return new AnticipateInterpolator();
        case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
            return new AnticipateOvershootInterpolator();
        case BOUNCE_INTERPOLATOR:
            return new BounceInterpolator();
        case DECELERATE_INTERPOLATOR:
            return new DecelerateInterpolator();
        case FAST_OUT_LINEAR_IN_INTERPOLATOR:
            return new FastOutLinearInInterpolator();
        case FAST_OUT_SLOW_IN_INTERPOLATOR:
            return new FastOutSlowInInterpolator();
        case LINEAR_INTERPOLATOR:
            return new LinearInterpolator();
        case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
            return new LinearOutSlowInInterpolator();
        case OVERSHOOT_INTERPOLATOR:
            return new OvershootInterpolator();
        default:
            return new LinearInterpolator();
    }
}
AnimationUtil.java 文件源码 项目:Hotspot-master-devp 阅读 30 收藏 0 点赞 0 评论 0
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch (interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
MainActivity.java 文件源码 项目:pipe 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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();
}
IntroActivity.java 文件源码 项目:Bigbang 阅读 28 收藏 0 点赞 0 评论 0
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();
        }
    }
}
UserSelectFriendsActivity.java 文件源码 项目:OSchina_resources_android 阅读 29 收藏 0 点赞 0 评论 0
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();
}
BaseCircle.java 文件源码 项目:boohee_v5.6 阅读 26 收藏 0 点赞 0 评论 0
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();
}
LineIndicator.java 文件源码 项目:boohee_v5.6 阅读 31 收藏 0 点赞 0 评论 0
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();
}
MicrophoneRecorderView.java 文件源码 项目:Cable-Android 阅读 29 收藏 0 点赞 0 评论 0
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);
}
Utils.java 文件源码 项目:Tab_Navigator 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Creates interpolator.
 * @return  a timeinterpolator
 * @param interpolatorType a int value from 0 to 10
 */
public static TimeInterpolator createInterpolator(
    @IntRange(from = 0, to = 10) final int interpolatorType) {
  switch (interpolatorType) {
    case ACCELERATE_DECELERATE_INTERPOLATOR:
      return new AccelerateDecelerateInterpolator();
    case ACCELERATE_INTERPOLATOR:
      return new AccelerateInterpolator();
    case ANTICIPATE_INTERPOLATOR:
      return new AnticipateInterpolator();
    case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
      return new AnticipateOvershootInterpolator();
    case BOUNCE_INTERPOLATOR:
      return new BounceInterpolator();
    case DECELERATE_INTERPOLATOR:
      return new DecelerateInterpolator();
    case FAST_OUT_LINEAR_IN_INTERPOLATOR:
      return new FastOutLinearInInterpolator();
    case FAST_OUT_SLOW_IN_INTERPOLATOR:
      return new FastOutSlowInInterpolator();
    case LINEAR_INTERPOLATOR:
      return new LinearInterpolator();
    case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
      return new LinearOutSlowInInterpolator();
    case OVERSHOOT_INTERPOLATOR:
      return new OvershootInterpolator();
    default:
      return new LinearInterpolator();
  }
}
DetailActivity.java 文件源码 项目:MaterialList 阅读 21 收藏 0 点赞 0 评论 0
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();
}
TinderStackLayout.java 文件源码 项目:TinderStack 阅读 25 收藏 0 点赞 0 评论 0
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);
}
PasswActivity.java 文件源码 项目:BigApp_Discuz_Android 阅读 78 收藏 0 点赞 0 评论 0
/**
 * 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());
}
CardGroup.java 文件源码 项目:CardsView 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 重置下面的卡片
 * @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();
    }
}
MainFragment.java 文件源码 项目:media 阅读 27 收藏 0 点赞 0 评论 0
@Override
protected void animatePreviewViewDuringCameraTypeToggle(@NonNull ViewPropertyAnimator animator) {
  animator.rotationYBy(360)
      .setDuration(1500)
      .setInterpolator(new AnticipateOvershootInterpolator())
      .start();
}
AnimationController.java 文件源码 项目:AyoSunny 阅读 23 收藏 0 点赞 0 评论 0
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch (interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
RadioRealButtonGroup.java 文件源码 项目:RadioRealButton 阅读 26 收藏 0 点赞 0 评论 0
private void initInterpolations() {
    Class[] interpolations = {
            FastOutSlowInInterpolator.class,
            BounceInterpolator.class,
            LinearInterpolator.class,
            DecelerateInterpolator.class,
            CycleInterpolator.class,
            AnticipateInterpolator.class,
            AccelerateDecelerateInterpolator.class,
            AccelerateInterpolator.class,
            AnticipateOvershootInterpolator.class,
            FastOutLinearInInterpolator.class,
            LinearOutSlowInInterpolator.class,
            OvershootInterpolator.class};

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

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

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


问题


面经


文章

微信
公众号

扫码关注公众号