當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueAnimator.setFloatValues方法代碼示例

本文整理匯總了Java中android.animation.ValueAnimator.setFloatValues方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.setFloatValues方法的具體用法?Java ValueAnimator.setFloatValues怎麽用?Java ValueAnimator.setFloatValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.setFloatValues方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startSunShadow

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startSunShadow() {
    isDrawSunShadow=true;
    ValueAnimator valueAnimator=animMap.get(ANIM_WEATHER_SHADOW);
    if (valueAnimator==null){
        valueAnimator=ValueAnimator.ofFloat().setDuration(400);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                sunShadowWidth= (float) animation.getAnimatedValue();
            }
        });
        animMap.put(ANIM_WEATHER_SHADOW,valueAnimator);
    }
    valueAnimator.setFloatValues(0,getMeasuredWidth(),getMeasuredWidth()*0.8f);
    startValueAnimator(valueAnimator);
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:17,代碼來源:WeatherView.java

示例2: onFling

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    if (mBoundWidth * scale > getWidth()) {
        float sx = translateLeft + (1f / 2f) * velocityX * 0.5f * 0.5f;
        sx = getExplicitTranslateLeft(sx);
        ValueAnimator mResetXAnimator = getResetXAnimator();
        mResetXAnimator.setDuration(300);
        mResetXAnimator.setInterpolator(mDecInterpolator);
        mResetXAnimator.setFloatValues(translateLeft, sx);
        mResetXAnimator.addUpdateListener(getOnTranslateXAnimationUpdate());
        mResetXAnimator.start();
    }

    if (mBoundHeight * scale > getHeight()) {
        float sy = translateTop + (1f / 2f) * velocityY * 0.5f * 0.5f;
        sy = getExplicitTranslateTop(sy);
        ValueAnimator mResetYAnimator = getResetYAnimator();
        mResetYAnimator.setDuration(300);
        mResetYAnimator.setInterpolator(mDecInterpolator);
        mResetYAnimator.setFloatValues(translateTop, sy);
        mResetYAnimator.addUpdateListener(getOnTranslateYAnimationUpdate());
        mResetYAnimator.start();
    }

    return true;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:27,代碼來源:ImagePreviewView.java

示例3: onDoubleTap

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public boolean onDoubleTap(MotionEvent e) {
    isAutoScale = true;
    ValueAnimator mResetScaleAnimator = getResetScaleAnimator();

    if (scale == 1.f) {
        mResetScaleAnimator.setFloatValues(1.f, 2.f);

        ValueAnimator mResetXAnimator = getResetXAnimator();
        ValueAnimator mResetYAnimator = getResetYAnimator();
        mResetXAnimator.setFloatValues(translateLeft, (getWidth() - mBoundWidth * 2.f) / 2.f);
        mResetYAnimator.setFloatValues(translateTop, getDefaultTranslateTop(getHeight(), mBoundHeight * 2));
        mResetXAnimator.addUpdateListener(getOnTranslateXAnimationUpdate());
        mResetYAnimator.addUpdateListener(getOnTranslateYAnimationUpdate());
        mResetXAnimator.start();
        mResetYAnimator.start();
    } else {
        mResetScaleAnimator.setFloatValues(scale, 1.f);
        resetDefaultState();
    }

    mResetScaleAnimator.addUpdateListener(getOnScaleAnimationUpdate());
    mResetScaleAnimator.start();
    return true;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:26,代碼來源:ImagePreviewView.java

示例4: decelerate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void decelerate() {
    if (mAccelerateAnimator != null && mAccelerateAnimator.isRunning()) {
        mAccelerateAnimator.cancel();
    }
    if (mFlushRate == FLUSH_RATE) return;
    ValueAnimator animator = getDecelerateAnimator();
    if (animator.isRunning()) animator.cancel();
    long duration = (long) (((float) FLUSH_RATE - mFlushRate) / FLUSH_RATE * 1000);
    if (duration == 0) {
        mFlushRate = FLUSH_RATE;
        return;
    }
    animator.setDuration(duration);
    animator.setFloatValues(mFlushRate, FLUSH_RATE);
    animator.start();
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:SolarSystemView.java

示例5: startCheckedAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startCheckedAnim() {
    ValueAnimator animator = new ValueAnimator();
    final float hookMaxValue = (this.mHookSize + this.mEndLeftHookOffset) - this
            .mBaseLeftHookOffset;
    final float circleMaxFraction = this.mHookSize / hookMaxValue;
    final float circleMaxValue = 360.0f / circleMaxFraction;
    animator.setFloatValues(new float[]{0.0f, 1.0f});
    animator.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            float fraction = animation.getAnimatedFraction();
            AnimCheckBox.this.mHookOffset = hookMaxValue * fraction;
            if (fraction <= circleMaxFraction) {
                AnimCheckBox.this.mSweepAngle = (float) ((int) ((circleMaxFraction -
                        fraction) * circleMaxValue));
            } else {
                AnimCheckBox.this.mSweepAngle = 0.0f;
            }
            AnimCheckBox.this.mInnerCircleAlpha = (int) (255.0f * fraction);
            AnimCheckBox.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(500).start();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:25,代碼來源:AnimCheckBox.java

示例6: startUnCheckedAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startUnCheckedAnim() {
    ValueAnimator animator = new ValueAnimator();
    final float hookMaxValue = (this.mHookSize + this.mEndLeftHookOffset) - this
            .mBaseLeftHookOffset;
    final float circleMinFraction = (this.mEndLeftHookOffset - this.mBaseLeftHookOffset) /
            hookMaxValue;
    final float circleMaxValue = 360.0f / (1.0f - circleMinFraction);
    animator.setFloatValues(new float[]{0.0f, 1.0f});
    animator.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            float circleFraction = animation.getAnimatedFraction();
            float fraction = 1.0f - circleFraction;
            AnimCheckBox.this.mHookOffset = hookMaxValue * fraction;
            if (circleFraction >= circleMinFraction) {
                AnimCheckBox.this.mSweepAngle = (float) ((int) ((circleFraction -
                        circleMinFraction) * circleMaxValue));
            } else {
                AnimCheckBox.this.mSweepAngle = 0.0f;
            }
            AnimCheckBox.this.mInnerCircleAlpha = (int) (255.0f * fraction);
            AnimCheckBox.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(500).start();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:27,代碼來源:AnimCheckBox.java

示例7: init

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void init() {
    mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mDecorView = (ViewGroup) mContext.getWindow().getDecorView();

    mPopup = new PopupLayer(mContext, mRadius);
    mPopup.setVisibility(INVISIBLE);
    mAlphAnimator = new ValueAnimator();
    mAlphAnimator.setFloatValues(0.0f, 1.0f);
    mAlphAnimator.setDuration(mAnimDuration);
    mAlphAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    mAlphAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPopup.setShadowViewAlpha(Float.valueOf(animation.getAnimatedValue() + ""));
        }
    });

    addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            initButtons();
            if (onButtonPreparedListener != null)
                onButtonPreparedListener.onPrepared(mButtons);
        }
    });

}
 
開發者ID:panshen,項目名稱:PopupCircleMenu,代碼行數:28,代碼來源:PopupCircleView.java

示例8: createAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private ValueAnimator createAnimator(@NonNull ShadowAnimatorImpl impl) {
    final ValueAnimator animator = new ValueAnimator();
    animator.setInterpolator(ANIM_INTERPOLATOR);
    animator.setDuration(PRESSED_ANIM_DURATION);
    animator.addListener(impl);
    animator.addUpdateListener(impl);
    animator.setFloatValues(0, 1);
    return animator;
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:10,代碼來源:FloatingActionButtonImpl.java

示例9: resetDefaultState

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void resetDefaultState() {
    if (translateLeft != 0) {
        ValueAnimator mTranslateXAnimator = getResetXAnimator();
        mTranslateXAnimator.setFloatValues(translateLeft, 0);
        mTranslateXAnimator.addUpdateListener(getOnTranslateXAnimationUpdate());
        mTranslateXAnimator.start();
    }

    ValueAnimator mTranslateYAnimator = getResetYAnimator();
    mTranslateYAnimator.setFloatValues(translateTop, getDefaultTranslateTop(getHeight(), mBoundHeight));
    mTranslateYAnimator.addUpdateListener(getOnTranslateYAnimationUpdate());
    mTranslateYAnimator.start();

}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:15,代碼來源:ImagePreviewView.java

示例10: accelerate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void accelerate() {
    if (mFlushRate == FLUSH_RATE_LIMITATION) return;
    mFlushRate = FLUSH_RATE; // reset flush rate
    ValueAnimator animator = getAccelerateAnimator();
    if (animator.isRunning()) animator.cancel();
    animator.setFloatValues(mFlushRate, FLUSH_RATE_LIMITATION);
    animator.start();
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:9,代碼來源:SolarSystemView.java

示例11: setupAnimations

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void setupAnimations() {
    mScrollAnimator = new ValueAnimator();
    mScrollAnimator.setFloatValues(0, 1);
    mScrollAnimator.setRepeatCount(Animation.INFINITE);
    mScrollAnimator.setRepeatMode(ValueAnimator.RESTART);
    mScrollAnimator.setInterpolator(LINEAR_INTERPOLATOR);
    mScrollAnimator.setDuration(ANIMATION_DURATION);
    mScrollAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setRotate((float) animation.getAnimatedValue());
        }
    });

}
 
開發者ID:tohodog,項目名稱:QSRefreshLayout,代碼行數:16,代碼來源:SunRefreshDraw.java

示例12: setupAnimations

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void setupAnimations() {
    mScrollAnimator = new ValueAnimator();
    mScrollAnimator.setFloatValues(0, 1);
    mScrollAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
    mScrollAnimator.setDuration(ANIMATION_DURATION);
    mScrollAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mScrollAnimator.setRepeatMode(ValueAnimator.REVERSE);
    mScrollAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setLoadingAnimationTime((float) animation.getAnimatedValue());
        }
    });

}
 
開發者ID:tohodog,項目名稱:QSRefreshLayout,代碼行數:16,代碼來源:PlainRefreshDraw.java

示例13: animate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void animate(float f) {
    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.setFloatValues(percent, f);
    valueAnimator.setDuration(500);
    valueAnimator.addUpdateListener(this);
    valueAnimator.start();
}
 
開發者ID:RoyWallace,項目名稱:LineAnimation,代碼行數:8,代碼來源:SubtitleView.java

示例14: ProgressBar

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public ProgressBar(Context c, AttributeSet attrs) {
	super(c, attrs);

	mDensity = c.getResources().getDisplayMetrics().density;

	final TypedArray ta = c.obtainStyledAttributes(attrs, R.styleable.ProgressBar);
	try {
		mBarColor = ta.getColor(
				R.styleable.ProgressBar_barColor,
				c.getResources().getColor(android.R.color.holo_blue_light));
		mSolidBarHeight = ta.getDimensionPixelSize(
				R.styleable.ProgressBar_barHeight,
				Math.round(DEFAULT_BAR_HEIGHT_DP * mDensity));
		mSolidBarDetentWidth = ta.getDimensionPixelSize(
				R.styleable.ProgressBar_detentWidth,
				Math.round(DEFAULT_DETENT_WIDTH_DP * mDensity));
		mUseShadow = ta.getBoolean(
				R.styleable.ProgressBar_useShadow,
				false);
	} finally {
		ta.recycle();
	}

	mAnimator = new ValueAnimator();
	mAnimator.setFloatValues(1.0f, 2.0f);
	mAnimator.setRepeatCount(ValueAnimator.INFINITE);
	mAnimator.setInterpolator(new ExponentialInterpolator());
	mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		@Override
		public void onAnimationUpdate(ValueAnimator animation) {
			invalidate();
		}
	});

	mPaint.setColor(mBarColor);

	if (mUseShadow) {
		mShadow = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM,
				new int[]{(mBarColor & 0x00ffffff) | 0x22000000, 0});
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:42,代碼來源:ProgressBar.java

示例15: ofFloat

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public static ValueAnimator ofFloat(float... values) {
    ValueAnimator anim = new ValueAnimator();
    anim.setFloatValues(values);
    cancelOnDestroyActivity(anim);
    return anim;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:7,代碼來源:LauncherAnimUtils.java


注:本文中的android.animation.ValueAnimator.setFloatValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。