android.animation.PropertyValuesHolder#setEvaluator ( )源码实例Demo

下面列出了android.animation.PropertyValuesHolder#setEvaluator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Android-Image-Slider   文件: ColorAnimation.java
PropertyValuesHolder createColorPropertyHolder(boolean isReverse) {
    String propertyName;
    int colorStart;
    int colorEnd;

    if (isReverse) {
        propertyName = ANIMATION_COLOR_REVERSE;
        colorStart = this.colorEnd;
        colorEnd = this.colorStart;

    } else {
        propertyName = ANIMATION_COLOR;
        colorStart = this.colorStart;
        colorEnd = this.colorEnd;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, colorStart, colorEnd);
    holder.setEvaluator(new ArgbEvaluator());

    return holder;
}
 
源代码2 项目: Android-Image-Slider   文件: FillAnimation.java
@NonNull
private PropertyValuesHolder createRadiusPropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;

    if (isReverse) {
        propertyName = ANIMATION_RADIUS_REVERSE;
        startRadiusValue = radius / 2;
        endRadiusValue = radius;
    } else {
        propertyName = ANIMATION_RADIUS;
        startRadiusValue = radius;
        endRadiusValue = radius / 2;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
源代码3 项目: Android-Image-Slider   文件: FillAnimation.java
@NonNull
private PropertyValuesHolder createStrokePropertyHolder(boolean isReverse) {
    String propertyName;
    int startStrokeValue;
    int endStrokeValue;

    if (isReverse) {
        propertyName = ANIMATION_STROKE_REVERSE;
        startStrokeValue = radius;
        endStrokeValue = 0;
    } else {
        propertyName = ANIMATION_STROKE;
        startStrokeValue = 0;
        endStrokeValue = radius;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startStrokeValue, endStrokeValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
源代码4 项目: Android-Image-Slider   文件: ScaleDownAnimation.java
@NonNull
@Override
protected PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
	String propertyName;
	int startRadiusValue;
	int endRadiusValue;

	if (isReverse) {
		propertyName = ANIMATION_SCALE_REVERSE;
		startRadiusValue = (int) (radius * scaleFactor);
		endRadiusValue = radius;
	} else {
		propertyName = ANIMATION_SCALE;
		startRadiusValue = radius;
		endRadiusValue = (int) (radius * scaleFactor);
	}

	PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
	holder.setEvaluator(new IntEvaluator());

	return holder;
}
 
源代码5 项目: Android-Image-Slider   文件: ScaleAnimation.java
@NonNull
protected PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;

    if (isReverse) {
        propertyName = ANIMATION_SCALE_REVERSE;
        startRadiusValue = radius;
        endRadiusValue = (int) (radius * scaleFactor);
    } else {
        propertyName = ANIMATION_SCALE;
        startRadiusValue = (int) (radius * scaleFactor);
        endRadiusValue = radius;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
源代码6 项目: Android-Image-Slider   文件: SwapAnimation.java
private PropertyValuesHolder createColorPropertyHolder(String propertyName, int startValue, int endValue) {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startValue, endValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
源代码7 项目: Android-Image-Slider   文件: SlideAnimation.java
private PropertyValuesHolder createSlidePropertyHolder() {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(ANIMATION_COORDINATE, coordinateStart, coordinateEnd);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
源代码8 项目: AnimationEasingFunctions   文件: Glider.java
public static PropertyValuesHolder glide(Skill skill, float duration, PropertyValuesHolder propertyValuesHolder) {
    propertyValuesHolder.setEvaluator(skill.getMethod(duration));
    return propertyValuesHolder;
}
 
源代码9 项目: AnimationApiDemos   文件: OrreryActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.orrery_main);

	ImageView orrery = (ImageView) findViewById(R.id.orrery);
	OrreryDrawable myOrreryDrawable = OrreryDrawable.Create();
	orrery.setImageDrawable(myOrreryDrawable);

	// ================================================================
	// 分别控制两种属性的动画
	// PropertyValuesHolder earthPositionValues = PropertyValuesHolder
	// .ofFloat("EarthPosition", 0, (float) (2 * Math.PI));
	// PropertyValuesHolder moonPositionValues =
	// PropertyValuesHolder.ofFloat(
	// "MoonPosition", 0, (float) (2 * Math.PI * 13));
	// ObjectAnimator orreryAnimator =
	// ObjectAnimator.ofPropertyValuesHolder(
	// myOrreryDrawable, earthPositionValues, moonPositionValues);

	// ================================================================
	// 使用新的数据结构,同时控制地球和月球
	OrreryDrawable.SolarSystemData startSolarSystemData = new OrreryDrawable.SolarSystemData();
	startSolarSystemData.rotationEarth = 0;
	startSolarSystemData.rotationMoon = 0;
	OrreryDrawable.SolarSystemData endSolarSystemData = new OrreryDrawable.SolarSystemData();
	endSolarSystemData.rotationEarth = (float) (2 * Math.PI);
	endSolarSystemData.rotationMoon = (float) (2 * Math.PI * 13);
	// 使用自定义的Evaluator
	OrreryEvaluator orreryEvaluator = new OrreryEvaluator();
	// ObjectAnimator orreryAnimator = ObjectAnimator.ofObject(
	// myOrreryDrawable, "SolarSystemData", orreryEvaluator,
	// startSolarSystemData, endSolarSystemData);

	// ================================================================
	// 尝试一下Keyframe
	Keyframe startFrame = Keyframe.ofObject(0, startSolarSystemData);
	Keyframe endFrame = Keyframe.ofObject(1, endSolarSystemData);
	PropertyValuesHolder solarSystemFrames = PropertyValuesHolder
			.ofKeyframe("SolarSystemData", startFrame, endFrame);
	solarSystemFrames.setEvaluator(orreryEvaluator);

	ObjectAnimator orreryAnimator = ObjectAnimator.ofPropertyValuesHolder(
			myOrreryDrawable, solarSystemFrames);

	// Default value is 10
	Log.i("FrameDelay", "delay: " + ValueAnimator.getFrameDelay());
	ValueAnimator.setFrameDelay(50);

	orreryAnimator.setDuration(60000);
	orreryAnimator.setInterpolator(new LinearInterpolator());
	orreryAnimator.setRepeatCount(ValueAnimator.INFINITE);
	orreryAnimator.setRepeatMode(ValueAnimator.RESTART);

	orreryAnimator.start();

	// add the fragment:
	FragmentTransaction ft = getFragmentManager().beginTransaction();

	ft.setCustomAnimations(R.anim.fade_in, android.R.animator.fade_out);
	ft.add(R.id.frame, new OrreryInfo());
	ft.commit();
}