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

ValueAnimatorActivity.java 文件源码 项目:Android_Study_Demos 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 自由落体
 * 
 * @param view
 */
public void verticalRun(View view)
{
    ValueAnimator animator = ValueAnimator.ofFloat(0, mScreenHeight
            - mBlueBall.getHeight());
    //animator.setTarget(mBlueBall);
    animator.setDuration(1000).start();
    animator.setInterpolator(new BounceInterpolator());
    animator.addUpdateListener(new AnimatorUpdateListener()
    {
        @Override
        public void onAnimationUpdate(ValueAnimator animation)
        {
            mBlueBall.setTranslationY((Float) animation.getAnimatedValue());
        }
    });
}
ArcMenuActivity.java 文件源码 项目:Android_Study_Demos 阅读 22 收藏 0 点赞 0 评论 0
private void startAnim() {

    for(int i=1;i<ids.length;i++){
        ObjectAnimator animator=ObjectAnimator.ofFloat(imageList.get(i), "translationY", 
                0F,i*80F);

        //设置加速插值器
        //animator.setInterpolator(new AccelerateInterpolator());

        //设置弹跳插值器
        animator.setInterpolator(new BounceInterpolator());
        animator.setDuration(1000);
        animator.setStartDelay(i*300);
        animator.start();

    }
}
ToolTip.java 文件源码 项目:TourGuide 阅读 35 收藏 0 点赞 0 评论 0
public ToolTip(){
    /* default values */
    mTitle = "";
    mDescription = "";
    mBackgroundColor = Color.parseColor("#3498db");
    mTextColor = Color.parseColor("#FFFFFF");

    mEnterAnimation = new AlphaAnimation(0f, 1f);
    mEnterAnimation.setDuration(1000);
    mEnterAnimation.setFillAfter(true);
    mEnterAnimation.setInterpolator(new BounceInterpolator());
    mShadow = true;
    mWidth = -1;

    // TODO: exit animation
    mGravity = Gravity.CENTER;
}
MaterialWaveView.java 文件源码 项目:MousePaint 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void onRefreshing(MaterialRefreshLayout br) {
    setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
    ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(),0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
            setWaveHeight((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(200);
    animator.start();
}
AnimatorShaderRoundImageView.java 文件源码 项目:AndroidLife 阅读 27 收藏 0 点赞 0 评论 0
public void startAnimation(RectAttribute newCoordinates, Animator.AnimatorListener listener) {
    RectAttribute oldCoordinates = new RectAttribute(this.mRoundRect.left, this.mRoundRect.top,
        this.mRoundRect.right, this.mRoundRect.bottom, this.mBorderRadius);
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new RectAttributeEvaluator(),
        oldCoordinates, newCoordinates, oldCoordinates);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override public void onAnimationUpdate(ValueAnimator animation) {
            currentCoordinates = (RectAttribute) animation.getAnimatedValue();
            invalidate();
        }
    });
    valueAnimator.addListener(listener);
    valueAnimator.setInterpolator(new BounceInterpolator());
    valueAnimator.setDuration(2666);
    valueAnimator.start();
}
MainActivity.java 文件源码 项目:AdvanceReveal 阅读 20 收藏 0 点赞 0 评论 0
public void enlargeReveal(View v) {

    RevealAnimator animator1 = new RevealAnimator(drawable);
    animator1.radius(100)
        .pivot(centerX, contentView.getHeight())
        .interpolator(new BounceInterpolator())
        .color(Color.CYAN);

    RevealAnimator animator2 = new RevealAnimator(drawable);
    animator2.radius(contentView.getHeight() + 100);

    RevealAnimator animator3 = new RevealAnimator(drawable);
    animator3.color(Color.YELLOW).duration(2000);

    animator1.withNextAnim(animator2.withNextAnim(animator3)).start();
  }
DefaultCardStreamAnimator.java 文件源码 项目:android-play-places 阅读 21 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY){

    float deltaXAbs = Math.abs(deltaX);

    float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
    long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));

    // Animate position and alpha of swiped item

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1.f),
            PropertyValuesHolder.ofFloat("translationX", 0.f),
            PropertyValuesHolder.ofFloat("rotationY", 0.f));

    animator.setDuration(duration).setInterpolator(new BounceInterpolator());

    return  animator;
}
PullDoorView.java 文件源码 项目:XmppTest 阅读 28 收藏 0 点赞 0 评论 0
private void setupView() {

        // 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
        Interpolator polator = new BounceInterpolator();
        mScroller = new Scroller(mContext, polator);

        // 获取屏幕分辨率
        WindowManager wm = (WindowManager) (mContext
                .getSystemService(Context.WINDOW_SERVICE));
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        mScreenHeigh = dm.heightPixels;
        mScreenWidth = dm.widthPixels;

        // 这里你一定要设置成透明背景,不然会影响你看到底层布局
        this.setBackgroundColor(Color.argb(0, 0, 0, 0));
        mImgView = new ImageView(mContext);
        mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT));
        mImgView.setScaleType(ImageView.ScaleType.FIT_XY);// 填充整个屏幕
        // mImgView.setImageResource(R.drawable.ic_launcher); // 默认背景
        mImgView.setBackgroundColor(Color.parseColor("#60000000"));
        addView(mImgView);
    }
AppTitleView.java 文件源码 项目:uwaterloo-api 阅读 22 收藏 0 点赞 0 评论 0
private void init() {
  setText(getResources().getString(R.string.app_name).toLowerCase());
  FontUtils.apply(this, FontUtils.ULTRA);

  if (!sDidAnimate && !isInEditMode()) {
    sDidAnimate = true;

    final ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
    animator.addUpdateListener(anim -> setLetterSpacing((Float) anim.getAnimatedValue()));
    animator.setStartDelay(500L);
    animator.setDuration(2000L);
    animator.setInterpolator(new BounceInterpolator());
    animator.start();

    setAlpha(0);
    final ValueAnimator alphaAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 0, 1);
    alphaAnimator.setStartDelay(500L);
    alphaAnimator.setDuration(1000L);
    alphaAnimator.setInterpolator(new FastOutSlowInInterpolator());
    alphaAnimator.start();
  }
}
PullDoorView.java 文件源码 项目:UltimateAndroid 阅读 33 收藏 0 点赞 0 评论 0
@SuppressLint("NewApi")
private void setupView() {

    // 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
    Interpolator polator = new BounceInterpolator();
    mScroller = new Scroller(mContext, polator);

    // 获取屏幕分辨率
    WindowManager wm = (WindowManager) (mContext
            .getSystemService(Context.WINDOW_SERVICE));
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    mScreenHeigh = dm.heightPixels;
    mScreenWidth = dm.widthPixels;

    // 这里你一定要设置成透明背景,不然会影响你看到底层布局
    this.setBackgroundColor(Color.argb(0, 0, 0, 0));
    mImgView = new ImageView(mContext);
    mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT));
    mImgView.setScaleType(ImageView.ScaleType.FIT_XY);// 填充整个屏幕
    mImgView.setImageResource(R.drawable.test); // 默认背景
    addView(mImgView);
}


问题


面经


文章

微信
公众号

扫码关注公众号