use of android.animation.Keyframe in project MaterialDateTimePicker by wdullaer.
the class RadialSelectorView method getReappearAnimator.
public ObjectAnimator getReappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2, kf3;
float midwayPoint = 0.2f;
int duration = 500;
// The time points are half of what they would normally be, because this animation is
// staggered against the disappear so they happen seamlessly. The reappear starts
// halfway into the disappear.
float delayMultiplier = 0.25f;
float transitionDurationMultiplier = 1f;
float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
int totalDuration = (int) (duration * totalDurationMultiplier);
float delayPoint = (delayMultiplier * duration) / totalDuration;
midwayPoint = 1 - (midwayPoint * (1 - delayPoint));
kf0 = Keyframe.ofFloat(0f, mTransitionEndRadiusMultiplier);
kf1 = Keyframe.ofFloat(delayPoint, mTransitionEndRadiusMultiplier);
kf2 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
kf3 = Keyframe.ofFloat(1f, 1);
PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe("animationRadiusMultiplier", kf0, kf1, kf2, kf3);
kf0 = Keyframe.ofFloat(0f, 0f);
kf1 = Keyframe.ofFloat(delayPoint, 0f);
kf2 = Keyframe.ofFloat(1f, 1f);
PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);
ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, radiusReappear, fadeIn).setDuration(totalDuration);
reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return reappearAnimator;
}
use of android.animation.Keyframe in project MaterialDateTimePicker by wdullaer.
the class Utils method getPulseAnimator.
/**
* Render an animator to pulsate a view in place.
* @param labelToAnimate the view to pulsate.
* @return The animator object. Use .start() to begin.
*/
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) {
Keyframe k0 = Keyframe.ofFloat(0f, 1f);
Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
Keyframe k3 = Keyframe.ofFloat(1f, 1f);
PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);
return pulseAnimator;
}
use of android.animation.Keyframe in project seven_develop by seven123456.
the class SpriteAnimatorBuilder method holder.
private PropertyValuesHolder holder(float[] fractions, Property property, int[] values) {
ensurePair(fractions.length, values.length);
Keyframe[] keyframes = new Keyframe[fractions.length];
for (int i = 0; i < values.length; i++) {
keyframes[i] = Keyframe.ofInt(fractions[i], values[i]);
}
PropertyValuesHolder valuesHolder = PropertyValuesHolder.ofKeyframe(property, keyframes);
propertyValuesHolders.add(valuesHolder);
return valuesHolder;
}
use of android.animation.Keyframe in project seven_develop by seven123456.
the class SpriteAnimatorBuilder method holder.
private PropertyValuesHolder holder(float[] fractions, Property property, float[] values) {
ensurePair(fractions.length, values.length);
Keyframe[] keyframes = new Keyframe[fractions.length];
for (int i = 0; i < values.length; i++) {
keyframes[i] = Keyframe.ofFloat(fractions[i], values[i]);
}
PropertyValuesHolder valuesHolder = PropertyValuesHolder.ofKeyframe(property, keyframes);
propertyValuesHolders.add(valuesHolder);
return valuesHolder;
}
Aggregations