本文整理了Java中android.animation.ObjectAnimator.ofPropertyValuesHolder()
方法的一些代码示例,展示了ObjectAnimator.ofPropertyValuesHolder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.ofPropertyValuesHolder()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:ofPropertyValuesHolder
暂无
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
view.setAlpha(0f);
view.setScaleX(0f);
view.setScaleY(0f);
return ObjectAnimator.ofPropertyValuesHolder(
view,
PropertyValuesHolder.ofFloat(View.ALPHA, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f));
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static <T> ObjectAnimator ofInt(@Nullable T target,
@NonNull Property<T, Integer> xProperty,
@NonNull Property<T, Integer> yProperty,
@NonNull Path path) {
int[] xValues = new int[NUM_POINTS];
int[] yValues = new int[NUM_POINTS];
calculateXYValues(path, xValues, yValues);
PropertyValuesHolder xPvh = PropertyValuesHolder.ofInt(xProperty, xValues);
PropertyValuesHolder yPvh = PropertyValuesHolder.ofInt(yProperty, yValues);
return ObjectAnimator.ofPropertyValuesHolder(target, xPvh, yPvh);
}
代码示例来源:origin: willowtreeapps/spruce-android
public static Animator growAnimator(View view, long duration) {
return ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat(View.SCALE_X, GROW_SCALE, ORIGINAL_SCALE),
PropertyValuesHolder.ofFloat(View.SCALE_Y, GROW_SCALE, ORIGINAL_SCALE))
.setDuration(duration);
}
代码示例来源:origin: willowtreeapps/spruce-android
public static Animator shrinkAnimator(View view, long duration) {
return ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat(View.SCALE_X, SHRINK_SCALE, ORIGINAL_SCALE),
PropertyValuesHolder.ofFloat(View.SCALE_Y, SHRINK_SCALE, ORIGINAL_SCALE))
.setDuration(duration);
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static ObjectAnimator ofFloat(@Nullable Object target, @NonNull String xPropertyName,
@NonNull String yPropertyName, @NonNull Path path) {
float[] xValues = new float[NUM_POINTS];
float[] yValues = new float[NUM_POINTS];
calculateXYValues(path, xValues, yValues);
PropertyValuesHolder xPvh = PropertyValuesHolder.ofFloat(xPropertyName, xValues);
PropertyValuesHolder yPvh = PropertyValuesHolder.ofFloat(yPropertyName, yValues);
return ObjectAnimator.ofPropertyValuesHolder(target, xPvh, yPvh);
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static ObjectAnimator ofInt(@Nullable Object target, @NonNull String xPropertyName,
@NonNull String yPropertyName, @NonNull Path path) {
int[] xValues = new int[NUM_POINTS];
int[] yValues = new int[NUM_POINTS];
calculateXYValues(path, xValues, yValues);
PropertyValuesHolder xPvh = PropertyValuesHolder.ofInt(xPropertyName, xValues);
PropertyValuesHolder yPvh = PropertyValuesHolder.ofInt(yPropertyName, yValues);
return ObjectAnimator.ofPropertyValuesHolder(target, xPvh, yPvh);
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static <T> ObjectAnimator ofFloat(@Nullable T target,
@NonNull Property<T, Float> xProperty,
@NonNull Property<T, Float> yProperty,
@NonNull Path path) {
float[] xValues = new float[NUM_POINTS];
float[] yValues = new float[NUM_POINTS];
calculateXYValues(path, xValues, yValues);
PropertyValuesHolder xPvh = PropertyValuesHolder.ofFloat(xProperty, xValues);
PropertyValuesHolder yPvh = PropertyValuesHolder.ofFloat(yProperty, yValues);
return ObjectAnimator.ofPropertyValuesHolder(target, xPvh, yPvh);
}
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
return ObjectAnimator.ofPropertyValuesHolder(
view,
PropertyValuesHolder.ofFloat(View.ALPHA, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f));
}
代码示例来源:origin: xinghongfei/LookLook
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
return ObjectAnimator.ofPropertyValuesHolder(
endValues.view,
PropertyValuesHolder.ofFloat(View.ALPHA, 0f, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 0f, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f, 1f));
}
代码示例来源:origin: xinghongfei/LookLook
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
return ObjectAnimator.ofPropertyValuesHolder(
endValues.view,
PropertyValuesHolder.ofFloat(View.ALPHA, 1f, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 0f));
}
代码示例来源:origin: ybq/Android-SpinKit
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(sprite,
holders);
animator.setDuration(duration);
代码示例来源:origin: wangdan/AisenWeiBo
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;
}
代码示例来源:origin: qs-lll/ExpandingPager
public void open() {
ViewGroup.LayoutParams layoutParams = layout3.getLayoutParams();
layoutParams.height = (int) (front.getHeight() * SCALE_OPENED / 4 * SCALE_OPENED);
layout3.setLayoutParams(layoutParams);
ViewCompat.setPivotY(back, 0);
PropertyValuesHolder front1 = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0, -front.getHeight() / 4);
PropertyValuesHolder front2 = PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1);
frontAnimator = ObjectAnimator.ofPropertyValuesHolder(front, front1, front2);
PropertyValuesHolder backX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f);
PropertyValuesHolder backY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f);
backAnimator = ObjectAnimator.ofPropertyValuesHolder(back, backX, backY);
back.setPivotY(0);
frontAnimator.start();
backAnimator.start();
front.setCardElevation(ELEVATION_OPENED);
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
/**
* 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;
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
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;
}
代码示例来源:origin: iSoron/uhabits
/**
* 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;
}
}
代码示例来源:origin: iSoron/uhabits
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;
}
代码示例来源:origin: wangdan/AisenWeiBo
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;
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);
ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
this, radiusReappear, fadeIn).setDuration(totalDuration);
reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
代码示例来源:origin: cymcsg/UltimateAndroid
/**
* Shake the view from left to right
*
* @param view
* @return
*/
public static ObjectAnimator leftRightShake(View view) {
// int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
int delta = 40;
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);
}
内容来源于网络,如有侵权,请联系作者删除!