本文整理汇总了Java中android.animation.PropertyValuesHolder类的典型用法代码示例。如果您正苦于以下问题:Java PropertyValuesHolder类的具体用法?Java PropertyValuesHolder怎么用?Java PropertyValuesHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyValuesHolder类属于android.animation包,在下文中一共展示了PropertyValuesHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideHint
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
private void hideHint(final View view) {
view.setPivotX(0);
view.setPivotY(view.getHeight());
Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat(View.ALPHA, 1f, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 0f));
iconAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
view.setVisibility(View.INVISIBLE);
}
});
iconAnim.start();
}
示例2: buildAnimation
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
@Override
public Animator buildAnimation(@NonNull ViewDefault viewDefault, @NonNull View viewToMorph, boolean isReversed) {
float x = isReversed ? initialScaleX : targetScaleX;
float y = isReversed ? initialScaleY : targetScaleY;
viewDefault.setExpansionScaleX(x);
viewDefault.setExpansionScaleY(y);
PropertyValuesHolder[] parameters = new PropertyValuesHolder[2];
parameters[0] = PropertyValuesHolder.ofFloat(View.SCALE_X, x);
parameters[1] = PropertyValuesHolder.ofFloat(View.SCALE_Y, y);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(viewToMorph, parameters);
if (duration >= 0) {
animator.setDuration(duration);
}
if (interpolator != null) {
animator.setInterpolator(interpolator);
}
return animator;
}
示例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: apply
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
animator = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat("alpha", 1, 0),
PropertyValuesHolder.ofFloat("translationY", 0, view.getHeight()));
animator.setDuration(3 * PRE_DURATION);
animator.setInterpolator(new AccelerateInterpolator());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
resetView(view);
if (action != null) {
action.action();
}
}
});
return this;
}
示例5: createCollapsingAnimator
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
private Animator createCollapsingAnimator(ArrowItemViewHolder newHolder, long duration) {
if (arrow != null) {
arrow.setVisibility(View.INVISIBLE);
}
final View oldView = itemView;
final View newView = newHolder.itemView;
final Animator backgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(oldView,
PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 255, 0));
backgroundAnimator.setDuration(duration);
final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView);
boundsAnimator.setDuration(duration);
boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN);
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(backgroundAnimator, boundsAnimator);
return animatorSet;
}
示例6: 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;
}
示例7: open
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
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);
}
示例8: getDisappearAnimator
import android.animation.PropertyValuesHolder; //导入依赖的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;
}
示例9: getBoundsAnimator
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
/**
* Returns an animator that animates the bounds of a single view.
*/
public static Animator getBoundsAnimator(View view, int fromLeft, int fromTop, int fromRight,
int fromBottom, int toLeft, int toTop, int toRight, int toBottom) {
view.setLeft(fromLeft);
view.setTop(fromTop);
view.setRight(fromRight);
view.setBottom(fromBottom);
return ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofInt(VIEW_LEFT, toLeft),
PropertyValuesHolder.ofInt(VIEW_TOP, toTop),
PropertyValuesHolder.ofInt(VIEW_RIGHT, toRight),
PropertyValuesHolder.ofInt(VIEW_BOTTOM, toBottom));
}
示例10: setData
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
@Override public void setData(Mail data) {
this.mail = data;
senderImageView.setImageResource(data.getSender().getImageRes());
senderNameView.setText(data.getSender().getName());
senderMailView.setText(data.getSender().getEmail());
subjectView.setText(data.getSubject());
contentView.setText(data.getText() + data.getText() + data.getText() + data.getText());
starView.setStarred(data.isStarred());
dateView.setText(format.format(data.getDate()));
labelView.setMail(data);
labelView.setVisibility(View.VISIBLE);
replayView.setVisibility(View.VISIBLE);
// Animate only if not restoring
if (!isRestoringViewState()) {
labelView.setAlpha(0f);
labelView.animate().alpha(1f).setDuration(150).start();
PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("scaleX", 0, 1);
PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("scaleY", 0, 1);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(replayView, holderX, holderY);
animator.setInterpolator(new OvershootInterpolator());
animator.start();
}
}
示例11: ofProperty
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
/**
* 设置属性
*
* @param name
* @return
*/
public UDAnimator ofProperty(final String name, float... values) {
final ObjectAnimator animator = getAnimator();
if (animator != null && TextUtils.isEmpty(name) == false && values != null) {
PropertyValuesHolder[] valuesHolders = null;
if (animator.getValues() != null && animator.getValues().length > 0) {
valuesHolders = Arrays.copyOf(animator.getValues(), animator.getValues().length + 1);
} else {
valuesHolders = new PropertyValuesHolder[1];
}
valuesHolders[valuesHolders.length - 1] = PropertyValuesHolder.ofFloat(name, values);
animator.setValues(valuesHolders);
}
return this;
}
示例12: 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;
}
示例13: initAnimators
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
private void initAnimators() {
// init from XML (one source of truth for initial view state)
mButtonIsOrWillBeVisible = mAddButton.getVisibility() == View.VISIBLE;
mButtonAppearAnimation = ObjectAnimator.ofPropertyValuesHolder(mAddButton,
PropertyValuesHolder.ofFloat("scaleX", 0.0f, 1.0f),
PropertyValuesHolder.ofFloat("scaleY", 0.0f, 1.0f));
mButtonAppearAnimation.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
mButtonAppearAnimation.setInterpolator(new FastOutSlowInInterpolator());
}
示例14: replace
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
private static void replace(ArrayList<PropertyValuesHolder> props, Object... args) {
for (final Object killobject : args) {
Tweener tween = sTweens.get(killobject);
if (tween != null) {
tween.animator.cancel();
if (props != null) {
tween.animator.setValues(
props.toArray(new PropertyValuesHolder[props.size()]));
} else {
sTweens.remove(tween);
}
}
}
}
示例15: createAnimation
import android.animation.PropertyValuesHolder; //导入依赖的package包/类
@Override
public List<Animator> createAnimation() {
List<Animator> animators=new ArrayList<>();
PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(2500);
animator.start();
animators.add(animator);
return animators;
}