本文整理汇总了Java中android.animation.PropertyValuesHolder.ofKeyframe方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyValuesHolder.ofKeyframe方法的具体用法?Java PropertyValuesHolder.ofKeyframe怎么用?Java PropertyValuesHolder.ofKeyframe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.PropertyValuesHolder
的用法示例。
在下文中一共展示了PropertyValuesHolder.ofKeyframe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPulseAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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: getReappearAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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;
}
示例3: getDisappearAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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;
}
示例4: nope
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
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);
}
示例5: getAnimationFor
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float force = animationBody.getForce();
float[] values = {
(float) Math.toDegrees(0),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(-0.3f * force),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(0f),
(float) Math.toDegrees(0f)
};
final PropertyValuesHolder pvhRotation =
PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, values));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation);
return animation;
}
示例6: getAnimationFor
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float force = animationBody.getForce();
float[] valuesX = {1f, 1.5f * force, 0.5f, 1.5f * force, 1f, 1f};
float[] valuesY = {1f, 0.5f, 1f, 0.5f, 1f, 1f};
final PropertyValuesHolder scaleXPVH =
PropertyValuesHolder.ofKeyframe(View.SCALE_X, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesX));
final PropertyValuesHolder scaleYPVH =
PropertyValuesHolder.ofKeyframe(View.SCALE_Y, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesY));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, scaleXPVH, scaleYPVH);
return animation;
}
示例7: getDisappearAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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;
}
示例8: getReappearAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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;
}
示例9: getReappearAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的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;
}
示例10: getPulseAnimator
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float
increaseRatio) {
Keyframe k0 = Keyframe.ofFloat(0.0f, 1.0f);
Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
Keyframe k3 = Keyframe.ofFloat(1.0f, 1.0f);
PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", new
Keyframe[]{k0, k1, k2, k3});
PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", new
Keyframe[]{k0, k1, k2, k3});
ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, new
PropertyValuesHolder[]{scaleX, scaleY});
pulseAnimator.setDuration(544);
return pulseAnimator;
}
示例11: getAnimationFor
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float force = animationBody.getForce();
float[] valuesX = {1f, 1.3f * force, 0.7f, 1.3f * force, 1f, 1f};
float[] valuesY = {1f, 0.7f, 1.3f * force, 0.7f, 1f, 1f};
final PropertyValuesHolder scaleXPVH =
ofKeyframe(View.SCALE_X, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesX));
final PropertyValuesHolder scaleYPVH =
PropertyValuesHolder.ofKeyframe(View.SCALE_Y, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesY));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, scaleXPVH, scaleYPVH);
return animation;
}
示例12: getAnimationFor
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float force = animationBody.getForce();
float[] rotationValues = {
(float) Math.toDegrees(0),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(-0.3f * force),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(0f),
(float) Math.toDegrees(0f)
};
final PropertyValuesHolder pvhRotation =
PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, rotationValues));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation);
return animation;
}
示例13: getAnimationFor
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float dX = DimensionUtils.dp2px(30);
final float force = animationBody.getForce();
float[] translationValues = {0f, (dX * force), (-dX * force), (dX * force), 0f, 0f};
final PropertyValuesHolder translationPVH =
PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X, KeyFrameUtil.getKeyFrames(FRACTIONS, translationValues));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, translationPVH);
return animation;
}
示例14: getRotation
import android.animation.PropertyValuesHolder; //导入方法依赖的package包/类
private Animator getRotation(AnimationBody animationBody, View view) {
final float force = animationBody.getForce();
float[] rotationValues = {
(float) Math.toDegrees(0),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(-0.3f * force),
(float) Math.toDegrees(0.3f * force),
(float) Math.toDegrees(0f),
(float) Math.toDegrees(0f)
};
final PropertyValuesHolder pvhRotation =
PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, rotationValues));
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation);
animation.setInterpolator(new LinearInterpolator());
return animation;
}
示例15: renderAnimations
import android.animation.PropertyValuesHolder; //导入方法依赖的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);
}