use of android.animation.PropertyValuesHolder in project AisenWeiBo by wangdan.
the class PicturePickFragment method switchDireListFragment.
void switchDireListFragment(View v) {
if (layFileDires.getVisibility() == View.GONE) {
layFileDires.setVisibility(View.VISIBLE);
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(300);
PropertyValuesHolder alphaPvh = null;
PropertyValuesHolder yPvh = null;
// 切换至隐藏
if (layFileDireBg.getAlpha() > 0.0f) {
expandDir = false;
alphaPvh = PropertyValuesHolder.ofFloat(View.ALPHA, 0.6f, 0.0f);
yPvh = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0, getRefreshView().getHeight());
} else {
expandDir = true;
alphaPvh = PropertyValuesHolder.ofFloat(View.ALPHA, 0.0f, 0.6f);
yPvh = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, getRefreshView().getHeight(), 0);
}
// 背景视图的动画
ObjectAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(layFileDireBg, alphaPvh);
animSet.playTogether(alphaAnim);
// 文件夹视图的动画
ObjectAnimator yAnim = ObjectAnimator.ofPropertyValuesHolder(layFileDires, yPvh);
animSet.playTogether(yAnim);
animSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (expandDir)
layFileDireBg.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
diresFragment.refreshUI();
if (!expandDir) {
layFileDireBg.setVisibility(View.GONE);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animSet.start();
}
use of android.animation.PropertyValuesHolder in project AisenWeiBo by wangdan.
the class Utils method getPulseAnimator.
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.PropertyValuesHolder in project AisenWeiBo by wangdan.
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.PropertyValuesHolder in project AisenWeiBo by wangdan.
the class RadialTextsView method renderAnimations.
/**
* Render the animations for appearing and disappearing.
*/
private void renderAnimations() {
Keyframe kf0, kf1, kf2, kf3;
float midwayPoint = 0.2f;
int duration = 500;
// Set up animator for disappearing.
kf0 = Keyframe.ofFloat(0f, 1);
kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier);
PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe("animationRadiusMultiplier", kf0, kf1, kf2);
kf0 = Keyframe.ofFloat(0f, 1f);
kf1 = Keyframe.ofFloat(1f, 0f);
PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);
mDisappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, radiusDisappear, fadeOut).setDuration(duration);
mDisappearAnimator.addUpdateListener(mInvalidateUpdateListener);
// Set up animator for reappearing.
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);
mReappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, radiusReappear, fadeIn).setDuration(totalDuration);
mReappearAnimator.addUpdateListener(mInvalidateUpdateListener);
}
use of android.animation.PropertyValuesHolder in project SublimePicker by vikramkakkar.
the class RadialTimePickerView method getFadeInAnimator.
private static ObjectAnimator getFadeInAnimator(IntHolder target, int startAlpha, int endAlpha, InvalidateUpdateListener updateListener) {
final float delayMultiplier = 0.25f;
final float transitionDurationMultiplier = 1f;
final float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
final int totalDuration = (int) (FADE_IN_DURATION * totalDurationMultiplier);
final float delayPoint = (delayMultiplier * FADE_IN_DURATION) / totalDuration;
final Keyframe kf0, kf1, kf2;
kf0 = Keyframe.ofInt(0f, startAlpha);
kf1 = Keyframe.ofInt(delayPoint, startAlpha);
kf2 = Keyframe.ofInt(1f, endAlpha);
final PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("value", kf0, kf1, kf2);
final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, fadeIn);
animator.setDuration(totalDuration);
animator.addUpdateListener(updateListener);
return animator;
}
Aggregations