Java Code Examples for android.animation.PropertyValuesHolder#setEvaluator()
The following examples show how to use
android.animation.PropertyValuesHolder#setEvaluator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorAnimation.java From Android-Image-Slider with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: FillAnimation.java From Android-Image-Slider with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: FillAnimation.java From Android-Image-Slider with Apache License 2.0 | 6 votes |
@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; }
Example 4
Source File: ScaleDownAnimation.java From Android-Image-Slider with Apache License 2.0 | 6 votes |
@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; }
Example 5
Source File: ScaleAnimation.java From Android-Image-Slider with Apache License 2.0 | 6 votes |
@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; }
Example 6
Source File: SwapAnimation.java From Android-Image-Slider with Apache License 2.0 | 4 votes |
private PropertyValuesHolder createColorPropertyHolder(String propertyName, int startValue, int endValue) { PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startValue, endValue); holder.setEvaluator(new IntEvaluator()); return holder; }
Example 7
Source File: SlideAnimation.java From Android-Image-Slider with Apache License 2.0 | 4 votes |
private PropertyValuesHolder createSlidePropertyHolder() { PropertyValuesHolder holder = PropertyValuesHolder.ofInt(ANIMATION_COORDINATE, coordinateStart, coordinateEnd); holder.setEvaluator(new IntEvaluator()); return holder; }
Example 8
Source File: Glider.java From AnimationEasingFunctions with MIT License | 4 votes |
public static PropertyValuesHolder glide(Skill skill, float duration, PropertyValuesHolder propertyValuesHolder) { propertyValuesHolder.setEvaluator(skill.getMethod(duration)); return propertyValuesHolder; }
Example 9
Source File: OrreryActivity.java From AnimationApiDemos with Apache License 2.0 | 4 votes |
@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(); }