当前位置: 首页>>代码示例>>Java>>正文


Java ValueAnimator.ofInt方法代码示例

本文整理汇总了Java中android.animation.ValueAnimator.ofInt方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.ofInt方法的具体用法?Java ValueAnimator.ofInt怎么用?Java ValueAnimator.ofInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.ofInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override public void setUpAnimation() {
  for (int i = 0; i < circlesSize; i++) {
    final int index = i;

    ValueAnimator fadeAnimator = ValueAnimator.ofInt(126, 255, 126);
    fadeAnimator.setRepeatCount(ValueAnimator.INFINITE);
    fadeAnimator.setDuration(1000);
    fadeAnimator.setStartDelay(index * 120);
    fadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override public void onAnimationUpdate(ValueAnimator animation) {
        circles[index].setAlpha((int)animation.getAnimatedValue());
        if (invalidateListener != null) {
          invalidateListener.reDraw();
        }
      }
    });

    fadeAnimator.start();
  }
}
 
开发者ID:nntuyen,项目名称:mkloader,代码行数:21,代码来源:ClassicSpinner.java

示例2: start

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void start() {
    if (mAnimator == null) {
        mAnimator = ValueAnimator.ofInt(0, 360);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                startAngle = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        mAnimator.setDuration(1000);
        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mAnimator.setRepeatMode(ValueAnimator.RESTART);
    }
    if (!mAnimator.isStarted()) {
        mAnimator.start();
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:SimpleCircleProgressBar.java

示例3: animToProgress

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 动画的方式执行动画
 */
private void animToProgress(int startP, int endP) {
    if (animator == null) {

    } else {
        animator.cancel();
    }

    animator = ValueAnimator.ofInt(startP, endP);
    animator.setDuration(200);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mProgress = (int) valueAnimator.getAnimatedValue();
            postInvalidateOnAnimation();
        }
    });
    animator.start();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:23,代码来源:SimpleProgressBar.java

示例4: initView

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initView() {
    mPath = new Paint();
    mPantR = new Paint();
    mPath.setAntiAlias(true);
    mPantR.setAntiAlias(true);
    mPath.setColor(Color.WHITE);
    mPantR.setColor(0x55000000);

    DensityUtil density = new DensityUtil();
    mRadius = density.dip2px(20);
    mOutsideCircle = density.dip2px(7);
    mPath.setStrokeWidth(density.dip2px(3));
    mPantR.setStrokeWidth(density.dip2px(3));

    mAnimator = ValueAnimator.ofInt(0,360);
    mAnimator.setDuration(720);
    mAnimator.addUpdateListener(animation -> {
        endAngle = (int) animation.getAnimatedValue();
        postInvalidate();
    });
    mAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
 
开发者ID:Brave-wan,项目名称:SmartRefresh,代码行数:24,代码来源:RoundProgressView.java

示例5: onScrollStateChanged

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);

    if (mAppBarLayout == null || newState != 0 || mAppBarLayoutDistance == 0
            || (mAppBarLayoutDistance == mAppBarLayout.getHeight() && mScrollDistance != 0)) {
        return;
    }

    boolean show = mAppBarLayoutDistance < mAppBarLayout.getHeight() * 0.5f
            || mScrollDistance <= mViewPagerParent.getHeight();
    ValueAnimator animator = ValueAnimator.ofInt(mAppBarLayoutDistance, show ? 0 : mAppBarLayout.getHeight());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mAppBarLayoutDistance = (int) animation.getAnimatedValue();
            mAppBarLayout.setTranslationY(-mAppBarLayoutDistance);
        }
    });
    animator.start();
}
 
开发者ID:AyushR1,项目名称:KernelAdiutor-Mod,代码行数:22,代码来源:RecyclerViewFragment.java

示例6: startAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 开启动画
 *
 * @param point    单位点
 * @param duration 持续时长
 */
private void startAnimation(final Point point, long duration) {
    ValueAnimator valueAnimator;
    // 1.判断是否有按下状态的图片的资源ID,采用不同策略的属性动画
    if (mPressImageId == 0) {
        // 2.判断动画缩放模式,采用不同策略的属性动画
        if (mAnimationScaleMode == 1) {
            valueAnimator = ValueAnimator.ofInt(point.radius, (int) (mAnimationScaleRate * point.radius), point.radius);
        } else {
            valueAnimator = ValueAnimator.ofInt((int) (mAnimationScaleRate * point.radius), point.radius);
        }
    } else {
        valueAnimator = ValueAnimator.ofInt(0, point.radius);
    }
    valueAnimator.setDuration(duration);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            point.radius = (int) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    valueAnimator.start();
    // 3.添加ValueAnimator至动画列表
    mPointAnimators.add(valueAnimator);
}
 
开发者ID:sinawangnan7,项目名称:GestureLockView,代码行数:32,代码来源:GestureLockView.java

示例7: setProgressWidthAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void setProgressWidthAnimation(@IntRange(from = 0, to = 100) int progress) {

        if (progress > 100) {
            progress = 100;
        }

        if (progress < 0) {
            progress = 0;
        }

        if (animator != null && animator.isRunning()) {
            animator.cancel();
            animator = null;
        }

        animator = ValueAnimator.ofInt(mProgress, progress);
        int duration = 15 * Math.abs(progress - mProgress);
        animator.setDuration(duration);

        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                int value = (int) valueAnimator.getAnimatedValue();
                if (mProgress != value) {
                    mProgress = value;
                    if (mListener != null) {
                        mListener.onProgressChanged(GradeProgressView.this, mProgress);
                    }
                    postInvalidate();
                }
            }
        });
        animator.start();

    }
 
开发者ID:SailFlorve,项目名称:RunHDU,代码行数:37,代码来源:GradeProgressView.java

示例8: smoothScrollTo

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void smoothScrollTo(int destHeight) {
    ValueAnimator animator = ValueAnimator.ofInt(getVisiableHeight(), destHeight);
    animator.setDuration(300).start();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setVisiableHeight((int) animation.getAnimatedValue());
        }
    });
    animator.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:YunRefreshHeader.java

示例9: smoothScrollTo

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 这是一个让布局高度改变的方法
 */
public void smoothScrollTo(int Height) {
    ValueAnimator animator = ValueAnimator.ofInt(getVisibleHeight(), Height);
    animator.setDuration(300).start();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setVisibleHeight((int) animation.getAnimatedValue());
        }
    });
    animator.start();
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:15,代码来源:YRecycleviewRefreshHeadView.java

示例10: animSpinner

import android.animation.ValueAnimator; //导入方法依赖的package包/类
protected ValueAnimator animSpinner(int endValue, Interpolator interpolator) {
    if (mSpinner != endValue) {
        if (reboundAnimator != null) {
            reboundAnimator.cancel();
        }
        reboundAnimator = ValueAnimator.ofInt(mSpinner, endValue);
        reboundAnimator.setDuration(mReboundDuration);
        reboundAnimator.setInterpolator(interpolator);
        reboundAnimator.addUpdateListener(reboundUpdateListener);
        reboundAnimator.addListener(reboundAnimatorEndListener);
        reboundAnimator.start();
    }
    return reboundAnimator;
}
 
开发者ID:Brave-wan,项目名称:SmartRefresh,代码行数:15,代码来源:SmartRefreshLayout.java

示例11: start

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void start() {
    if (mAnimator == null) {
        mAnimator = ValueAnimator.ofInt(0, LINE_COUNT - 1);
        mAnimator.addUpdateListener(mUpdateListener);
        mAnimator.setDuration(600);
        mAnimator.setRepeatMode(ValueAnimator.RESTART);
        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.start();
    } else if (!mAnimator.isStarted()) {
        mAnimator.start();
    }
}
 
开发者ID:coopese,项目名称:qmui,代码行数:14,代码来源:QMUILoadingView.java

示例12: startHideAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startHideAnimation() {
    //Start the Handler to clean up the Alert
    if (!enableInfiniteDuration) {
        runningAnimation = new Runnable() {
            @Override
            public void run() {
                hide();
            }
        };
        postDelayed(runningAnimation, duration);
    }

    if (enableProgress && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        pbProgress.setVisibility(View.VISIBLE);

        final ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100);
        valueAnimator.setDuration(getDuration());
        valueAnimator.setInterpolator(new LinearInterpolator());
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(final ValueAnimator animation) {
                getProgressBar().setProgress((int) animation.getAnimatedValue());
            }
        });
        valueAnimator.start();
    }

}
 
开发者ID:Tapadoo,项目名称:Alerter,代码行数:30,代码来源:Alert.java

示例13: hiddenRefreshHeaderView

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 隐藏下拉刷新控件,带动画
 */
private void hiddenRefreshHeaderView() {
    ValueAnimator animator = ValueAnimator.ofInt(mWholeHeaderView.getPaddingTop(), mMinWholeHeaderViewPaddingTop);
    animator.setDuration(mRefreshViewHolder.getTopAnimDuration());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int paddingTop = (int) animation.getAnimatedValue();
            mWholeHeaderView.setPadding(0, paddingTop, 0, 0);
        }
    });
    animator.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:BGARefreshLayout.java

示例14: animLayoutByTime

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void animLayoutByTime(int start, int end, AnimatorUpdateListener listener, AnimatorListener animatorListener) {
        ValueAnimator va = ValueAnimator.ofInt(start, end);
        va.setInterpolator(new DecelerateInterpolator());
        va.addUpdateListener(listener);
        va.addListener(animatorListener);
        va.setDuration((int) (Math.abs(start - end) * animFraction));
        va.start();
//        offerToQueue(va);
    }
 
开发者ID:Justson,项目名称:AgentWebX5,代码行数:10,代码来源:AnimProcessor.java

示例15: setCurrentData

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void setCurrentData(int data){

        ValueAnimator animator=ValueAnimator.ofInt(0,data);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                currentValue = (int) animation.getAnimatedValue();
                invalidate();
            }
        });
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(2500);
        animator.start();
    }
 
开发者ID:android-jian,项目名称:efficientclock,代码行数:15,代码来源:EfficientClock.java


注:本文中的android.animation.ValueAnimator.ofInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。