當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。