/**
* 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);
@SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
@SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
ObjectAnimator pulseAnimator =
ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);
return pulseAnimator;
}
java类android.animation.Keyframe的实例源码
Utils.java 文件源码
项目:TimePicker
阅读 30
收藏 0
点赞 0
评论 0
RadialSelectorView.java 文件源码
项目:AssistantBySDK
阅读 26
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:AssistantBySDK
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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;
}
ShakeListenerUtils.java 文件源码
项目:exciting-app
阅读 27
收藏 0
点赞 0
评论 0
public static ObjectAnimator nope(View view) {
int delta = view.getResources().getDimensionPixelOffset(R.dimen.height_16px);
PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
Keyframe.ofFloat(0f, 0),
Keyframe.ofFloat(.10f, -delta),
Keyframe.ofFloat(.26f, delta),
Keyframe.ofFloat(.42f, -delta),
Keyframe.ofFloat(.58f, delta),
Keyframe.ofFloat(.74f, -delta),
Keyframe.ofFloat(.90f, delta),
Keyframe.ofFloat(1f, 0f)
);
return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).
setDuration(500);
}
AnimationDemoActivity.java 文件源码
项目:DailyStudy
阅读 32
收藏 0
点赞 0
评论 0
/**
* keyframe
*/
private void keyFrame() {
Keyframe keyframe0 = Keyframe.ofFloat(0f, 0);
Keyframe keyframe1 = Keyframe.ofFloat(0.1f, 20f);
Keyframe keyframe2 = Keyframe.ofFloat(0.2f, -20f);
Keyframe keyframe3 = Keyframe.ofFloat(0.3f, 20f);
Keyframe keyframe4 = Keyframe.ofFloat(0.4f, -20f);
Keyframe keyframe5 = Keyframe.ofFloat(0.5f, 20f);
Keyframe keyframe6 = Keyframe.ofFloat(0.6f, -20f);
Keyframe keyframe7 = Keyframe.ofFloat(0.7f, 20f);
Keyframe keyframe8 = Keyframe.ofFloat(0.8f, -20f);
Keyframe keyframe9 = Keyframe.ofFloat(0.9f, 20f);
Keyframe keyframe10 = Keyframe.ofFloat(1f, 0);
PropertyValuesHolder holder = PropertyValuesHolder.ofKeyframe("rotation",
keyframe0, keyframe1, keyframe2, keyframe3, keyframe4, keyframe5,
keyframe6, keyframe7, keyframe8, keyframe9, keyframe10);
Animator animator = ObjectAnimator.ofPropertyValuesHolder(content, holder);
animator.setDuration(2000);
animator.start();
}
RadialSelectorView.java 文件源码
项目:boohee_v5.6
阅读 27
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (this.mIsInitialized && this.mDrawValuesReady) {
Keyframe kf0 = Keyframe.ofFloat(0.0f, 1.0f);
Keyframe kf1 = Keyframe.ofFloat(0.2f, this.mTransitionMidRadiusMultiplier);
Keyframe kf2 = Keyframe.ofFloat(1.0f, this.mTransitionEndRadiusMultiplier);
PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe
("animationRadiusMultiplier", new Keyframe[]{kf0, kf1, kf2});
kf0 = Keyframe.ofFloat(0.0f, 1.0f);
kf1 = Keyframe.ofFloat(1.0f, 0.0f);
PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", new
Keyframe[]{kf0, kf1});
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new
PropertyValuesHolder[]{radiusDisappear, fadeOut}).setDuration((long) 500);
disappearAnimator.addUpdateListener(this.mInvalidateUpdateListener);
return disappearAnimator;
}
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
RadialSelectorView.java 文件源码
项目:boohee_v5.6
阅读 34
收藏 0
点赞 0
评论 0
public ObjectAnimator getReappearAnimator() {
if (this.mIsInitialized && this.mDrawValuesReady) {
int totalDuration = (int) (((float) 500) * (1.0f + ChartZoomer.ZOOM_AMOUNT));
float delayPoint = (((float) 500) * ChartZoomer.ZOOM_AMOUNT) / ((float) totalDuration);
float midwayPoint = 1.0f - ((1.0f - delayPoint) * 0.2f);
Keyframe kf0 = Keyframe.ofFloat(0.0f, this.mTransitionEndRadiusMultiplier);
Keyframe kf1 = Keyframe.ofFloat(delayPoint, this.mTransitionEndRadiusMultiplier);
Keyframe kf2 = Keyframe.ofFloat(midwayPoint, this.mTransitionMidRadiusMultiplier);
Keyframe kf3 = Keyframe.ofFloat(1.0f, 1.0f);
PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe
("animationRadiusMultiplier", new Keyframe[]{kf0, kf1, kf2, kf3});
kf0 = Keyframe.ofFloat(0.0f, 0.0f);
kf1 = Keyframe.ofFloat(delayPoint, 0.0f);
kf2 = Keyframe.ofFloat(1.0f, 1.0f);
PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", new
Keyframe[]{kf0, kf1, kf2});
ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new
PropertyValuesHolder[]{radiusReappear, fadeIn}).setDuration((long) totalDuration);
reappearAnimator.addUpdateListener(this.mInvalidateUpdateListener);
return reappearAnimator;
}
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
RadialSelectorView.java 文件源码
项目:PersianAndroidDateTimePicker
阅读 33
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:PersianAndroidDateTimePicker
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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;
}
Utils.java 文件源码
项目:IIFYM
阅读 50
收藏 0
点赞 0
评论 0
/**
* 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;
}
RadialSelectorView.java 文件源码
项目:narrate-android
阅读 38
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:narrate-android
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
OpeningActivity.java 文件源码
项目:StarWarsOpening
阅读 27
收藏 0
点赞 0
评论 0
private void startIntroTextAnimation() {
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Animator introAnimator = AnimatorInflater.loadAnimator(this, R.animator.intro);
introAnimator.setTarget(introTextView);
introAnimator.start();
} else {
Keyframe kf0 = Keyframe.ofFloat(0f, 0);
Keyframe kf1 = Keyframe.ofFloat(.2f, 1);
Keyframe kf2 = Keyframe.ofFloat(.9f, 1);
Keyframe kf3 = Keyframe.ofFloat(1f, 0);
PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2, kf3);
ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(introTextView, pvh);
alphaAnimator.setInterpolator(new DecelerateInterpolator());
alphaAnimator.setDuration(6000).setStartDelay(1000);
alphaAnimator.start();
}
}
OpeningActivity.java 文件源码
项目:StarWarsOpening
阅读 22
收藏 0
点赞 0
评论 0
private void startLogoAnimation() {
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Animator logoAnimator = AnimatorInflater.loadAnimator(this, R.animator.logo);
logoAnimator.setTarget(logoView);
logoAnimator.start();
} else {
AnimatorSet animatorSet = new AnimatorSet();
PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha",
Keyframe.ofFloat(0f, 1),
Keyframe.ofFloat(.5f, 1),
Keyframe.ofFloat(1f, 0));
ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);
pvh = PropertyValuesHolder.ofKeyframe("scaleX", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
ObjectAnimator scaleXAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);
pvh = PropertyValuesHolder.ofKeyframe("scaleY", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
ObjectAnimator scaleYAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(9000).setStartDelay(9000);
animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator);
animatorSet.start();
}
}
RadialSelectorView.java 文件源码
项目:MaterialDateTimePicker
阅读 31
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:MaterialDateTimePicker
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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;
}
Utils.java 文件源码
项目:ClockPlus
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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;
}
RadialTimePickerView.java 文件源码
项目:CheckSmarter
阅读 37
收藏 0
点赞 0
评论 0
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;
}
Utils.java 文件源码
项目:BottomSheetPickers
阅读 47
收藏 0
点赞 0
评论 0
/**
* 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;
}
RadialSelectorView.java 文件源码
项目:Blackbulb
阅读 29
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:Blackbulb
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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;
}
PostAJobAnimatedView.java 文件源码
项目:android-complex-animation
阅读 32
收藏 0
点赞 0
评论 0
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private ObjectAnimator getAvatarAnimation(View view, int millis) {
PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
Keyframe.ofFloat(0f, 0.01f),
Keyframe.ofFloat(.035f, 0.45f),
Keyframe.ofFloat(.07f, 1.1f),
Keyframe.ofFloat(.09f, 1f),
Keyframe.ofFloat(.93f, .9f),
Keyframe.ofFloat(1f, 0f)
);
PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
Keyframe.ofFloat(0f, 0.01f),
Keyframe.ofFloat(.035f, 0.45f),
Keyframe.ofFloat(.07f, 1.1f),
Keyframe.ofFloat(.09f, 1f),
Keyframe.ofFloat(.93f, .9f),
Keyframe.ofFloat(1f, 0f)
);
return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY).
setDuration(millis);
}
RadialSelectorView.java 文件源码
项目:Android-SwitchDateTimePicker
阅读 31
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
LoginActivity.java 文件源码
项目:GitPath
阅读 41
收藏 0
点赞 0
评论 0
private void fail() {
loginBtn.setEnabled(true);
int delta = mOctocat.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
Keyframe.ofFloat(0f, 0),
Keyframe.ofFloat(.10f, -delta),
Keyframe.ofFloat(.26f, delta),
Keyframe.ofFloat(.42f, -delta),
Keyframe.ofFloat(.58f, delta),
Keyframe.ofFloat(.74f, -delta),
Keyframe.ofFloat(.90f, delta),
Keyframe.ofFloat(1f, 0f)
);
ObjectAnimator.ofPropertyValuesHolder(mOctocat, pvhTranslateX)
.setDuration(500).start();
}
RadialSelectorView.java 文件源码
项目:Doctor
阅读 27
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
Utils.java 文件源码
项目:Doctor
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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;
}
RadialTimePickerView.java 文件源码
项目:SublimePicker
阅读 27
收藏 0
点赞 0
评论 0
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;
}
MainActivity.java 文件源码
项目:auid2
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void onClick(final View button) {
button.setEnabled(false);
View icon = findViewById(R.id.icon);
Keyframe keyframe1 = Keyframe.ofFloat(0f, 0f);
Keyframe keyframe2 = Keyframe.ofFloat(.4f, 90f);
Keyframe keyframe3 = Keyframe.ofFloat(.6f, 90f);
Keyframe keyframe4 = Keyframe.ofFloat(1f, 0f);
PropertyValuesHolder propertyValuesHolder = PropertyValuesHolder.ofKeyframe("rotation", keyframe1, keyframe2, keyframe3, keyframe4);
ObjectAnimator rotationAnim = ObjectAnimator.ofPropertyValuesHolder(icon, propertyValuesHolder);
rotationAnim.setDuration(5000);
rotationAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
button.setEnabled(true);
}
});
rotationAnim.setInterpolator(new AccelerateDecelerateInterpolator());
rotationAnim.start();
}
Utils.java 文件源码
项目:SmoothDateRangePicker
阅读 43
收藏 0
点赞 0
评论 0
/**
* 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;
}
RadialSelectorView.java 文件源码
项目:TodayThing
阅读 34
收藏 0
点赞 0
评论 0
public ObjectAnimator getDisappearAnimator() {
if (!mIsInitialized || !mDrawValuesReady) {
Log.e(TAG, "RadialSelectorView was not ready for animation.");
return null;
}
Keyframe kf0, kf1, kf2;
float midwayPoint = 0.2f;
int duration = 500;
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);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}