本文整理汇总了Java中android.animation.Keyframe.ofFloat方法的典型用法代码示例。如果您正苦于以下问题:Java Keyframe.ofFloat方法的具体用法?Java Keyframe.ofFloat怎么用?Java Keyframe.ofFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.Keyframe
的用法示例。
在下文中一共展示了Keyframe.ofFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPulseAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
/**
* 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;
}
示例2: getDisappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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;
}
示例3: getPulseAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
/**
* 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;
}
示例4: getReappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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;
}
示例5: onClick
import android.animation.Keyframe; //导入方法依赖的package包/类
@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();
}
示例6: getPulseAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
/**
* 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;
}
示例7: getPulseAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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;
}
示例8: getPulseAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
/**
* 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;
}
示例9: getDisappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
@SuppressLint("ObjectAnimatorBinding")
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);
@SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);
ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
示例10: getReappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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);
@SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);
ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusReappear, fadeIn).setDuration(totalDuration);
reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return reappearAnimator;
}
示例11: getReappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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;
}
示例12: getKeyFrames
import android.animation.Keyframe; //导入方法依赖的package包/类
public static Keyframe[] getKeyFrames(float[] fractions, float[] values) {
final Keyframe[] keyframes = new Keyframe[fractions.length];
for (int i = 0; i < fractions.length; i++) {
keyframes[i] = Keyframe.ofFloat(fractions[i], values[i]);
}
return keyframes;
}
示例13: keyFrame
import android.animation.Keyframe; //导入方法依赖的package包/类
/**
* 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();
}
示例14: getDisappearAnimator
import android.animation.Keyframe; //导入方法依赖的package包/类
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;
}
示例15: renderAnimations
import android.animation.Keyframe; //导入方法依赖的package包/类
private void renderAnimations() {
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});
this.mDisappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new
PropertyValuesHolder[]{radiusDisappear, fadeOut}).setDuration((long) 500);
this.mDisappearAnimator.addUpdateListener(this.mInvalidateUpdateListener);
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);
kf0 = Keyframe.ofFloat(0.0f, this.mTransitionEndRadiusMultiplier);
kf1 = Keyframe.ofFloat(delayPoint, this.mTransitionEndRadiusMultiplier);
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});
this.mReappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new
PropertyValuesHolder[]{radiusReappear, fadeIn}).setDuration((long) totalDuration);
this.mReappearAnimator.addUpdateListener(this.mInvalidateUpdateListener);
}