当前位置: 首页>>代码示例>>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;未经允许,请勿转载。