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

SharedTargetFragment.java 文件源码 项目:FragmentRigger 阅读 19 收藏 0 点赞 0 评论 0
/**
 * This method will run the entry animation
 */
private void runEnterAnimation() {
  // We can now make it visible
  imageView.setVisibility(View.VISIBLE);
  // finally, run the animation
  if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
    imageView.animate()
        .setDuration(300)
        .setInterpolator(new AccelerateDecelerateInterpolator())
        .scaleX(1f)
        .scaleY(1f)
        .translationX(0)
        .translationY(0)
        .start();
  }
}
ImageViewTintUtils.java 文件源码 项目:revolution-irc 阅读 15 收藏 0 点赞 0 评论 0
public static void animateTint(ImageView view, int from, int to, int duration) {
    final float[] fromHSL = new float[3];
    final float[] toHSL = new float[3];
    float[] currentHSL = new float[3];
    ColorUtils.colorToHSL(from, fromHSL);
    ColorUtils.colorToHSL(to, toHSL);
    int fromAlpha = Color.alpha(from);
    int toAlpha = Color.alpha(to);

    final ValueAnimator anim = ObjectAnimator.ofFloat(0f, 1f);
    anim.addUpdateListener((ValueAnimator animation) -> {
        float mul = (Float) animation.getAnimatedValue();
        ColorUtils.blendHSL(fromHSL, toHSL, mul, currentHSL);
        int color = ColorUtils.HSLToColor(currentHSL);
        color = ColorUtils.setAlphaComponent(color, fromAlpha +
                (int) ((toAlpha - fromAlpha) * mul));
        setTint(view, color);
    });
    anim.setDuration(duration);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.start();
}
ZhiActivity.java 文件源码 项目:MiniPay 阅读 22 收藏 0 点赞 0 评论 0
private void initData() {
    Config config = (Config) getIntent().getSerializableExtra(MiniPayUtils.EXTRA_KEY_PAY_CONFIG);
    this.wechatQaImage = config.getWechatQaImage();
    this.aliQaImage = config.getAliQaImage();
    this.wechatTip = config.getWechatTip();
    this.aliTip = config.getAliTip();
    this.aliZhiKey = config.getAliZhiKey();

    if (!checkLegal()) {
        throw new IllegalStateException("MiniPay Config illegal!!!");
    } else {
        if (TextUtils.isEmpty(wechatTip)) wechatTip = getString(R.string.wei_zhi_tip);
        if (TextUtils.isEmpty(aliTip)) aliTip = getString(R.string.ali_zhi_tip);

        mZhiBg.setBackgroundResource(R.drawable.common_bg);
        mTitleTv.setText(R.string.wei_zhi_title);
        mSummeryTv.setText(wechatTip);
        mQaImage.setImageResource(wechatQaImage);
    }

    ObjectAnimator animator = ObjectAnimator.ofFloat(mTip, "alpha", 0, 0.66f, 1.0f, 0);
    animator.setDuration(2888);
    animator.setRepeatCount(6);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.start();
}
SecurityInfoDialog.java 文件源码 项目:q-mail 阅读 30 收藏 0 点赞 0 评论 0
private void prepareIconAnimation() {
    authenticationText.setAlpha(0.0f);
    trustText.setAlpha(0.0f);

    dialogView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
            float halfVerticalPixelDifference = (trustIconFrame.getY() - authenticationIconFrame.getY()) / 2.0f;
            authenticationIconFrame.setTranslationY(halfVerticalPixelDifference);
            trustIconFrame.setTranslationY(-halfVerticalPixelDifference);

            authenticationIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            trustIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            authenticationText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();
            trustText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();

            view.removeOnLayoutChangeListener(this);
        }
    });
}
PullLoadMoreRecyclerView.java 文件源码 项目:GitHub 阅读 42 收藏 0 点赞 0 评论 0
public void setPullLoadMoreCompleted() {
    isRefresh = false;
    setRefreshing(false);

    isLoadMore = false;
    mFooterView.animate()
            .translationY(mFooterView.getHeight())
            .setDuration(300)
            .setInterpolator(new AccelerateDecelerateInterpolator())
            .start();

}
MyLayoutAnimationHelper.java 文件源码 项目:RecyclerViewAnimation 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 从左侧进入,并带有弹性的动画
 *
 * @return
 */
public static AnimationSet getAnimationSetFromLeft() {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, -1.0f, RELATIVE_TO_SELF, 0.1f,
            RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
    translateX1.setDuration(300);
    translateX1.setInterpolator(new DecelerateInterpolator());
    translateX1.setStartOffset(0);

    TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, -0.1f,
            RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
    translateX2.setStartOffset(300);
    translateX2.setInterpolator(new DecelerateInterpolator());
    translateX2.setDuration(50);

    TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0f,
            RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
    translateX3.setStartOffset(350);
    translateX3.setInterpolator(new DecelerateInterpolator());
    translateX3.setDuration(50);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
    alphaAnimation.setDuration(400);
    alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());


    animationSet.addAnimation(translateX1);
    animationSet.addAnimation(translateX2);
    animationSet.addAnimation(translateX3);
    //animationSet.addAnimation(alphaAnimation);
    animationSet.setDuration(400);

    return animationSet;
}
WaveView.java 文件源码 项目:GitHub 阅读 28 收藏 0 点赞 0 评论 0
public void startDropAnimation() {
    // show dropBubble again
    mDisappearCircleAnimator = ValueAnimator.ofFloat(1.f, 1.f);
    mDisappearCircleAnimator.setDuration(1);
    mDisappearCircleAnimator.start();

    mDropCircleAnimator = ValueAnimator.ofFloat(500 * (mWidth / 1440.f), mMaxDropHeight);
    mDropCircleAnimator.setDuration(DROP_CIRCLE_ANIMATOR_DURATION);
    mDropCircleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mCurrentCircleCenterY = (float) animation.getAnimatedValue();
            postInvalidateOnAnimation();
        }
    });
    mDropCircleAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mDropCircleAnimator.start();

    mDropVertexAnimator = ValueAnimator.ofFloat(0.f, mMaxDropHeight - mDropCircleRadius);
    mDropVertexAnimator.setDuration(DROP_VERTEX_ANIMATION_DURATION);
    mDropVertexAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropVertexAnimator.start();

    mDropBounceVerticalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceVerticalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceVerticalAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropBounceVerticalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceVerticalAnimator.setStartDelay(DROP_VERTEX_ANIMATION_DURATION);
    mDropBounceVerticalAnimator.start();

    mDropBounceHorizontalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceHorizontalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceHorizontalAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropBounceHorizontalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceHorizontalAnimator.setStartDelay(
            (long) (DROP_VERTEX_ANIMATION_DURATION + DROP_BOUNCE_ANIMATOR_DURATION * 0.25));
    mDropBounceHorizontalAnimator.start();
}
FragmentContainerHelper.java 文件源码 项目:GitHub 阅读 29 收藏 0 点赞 0 评论 0
public void setInterpolator(Interpolator interpolator) {
    if (interpolator == null) {
        mInterpolator = new AccelerateDecelerateInterpolator();
    } else {
        mInterpolator = interpolator;
    }
}
PullLoadMoreRecyclerView.java 文件源码 项目:GCSApp 阅读 27 收藏 0 点赞 0 评论 0
public void setPullLoadMoreCompleted() {
    isRefresh = false;
    setRefreshing(false);

    isLoadMore = false;
    mFooterView.animate()
            .translationY(mFooterView.getHeight())
            .setDuration(300)
            .setInterpolator(new AccelerateDecelerateInterpolator())
            .start();

}
FlipAnimation.java 文件源码 项目:Flashcards-Demo 阅读 26 收藏 0 点赞 0 评论 0
public FlipAnimation(View fromView, View toView) {
    this.fromView = fromView;
    this.toView = toView;

    setDuration(700);
    setFillAfter(false);
    setInterpolator(new AccelerateDecelerateInterpolator());
}


问题


面经


文章

微信
公众号

扫码关注公众号