本文整理汇总了Java中com.nineoldandroids.animation.ObjectAnimator类的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator类的具体用法?Java ObjectAnimator怎么用?Java ObjectAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectAnimator类属于com.nineoldandroids.animation包,在下文中一共展示了ObjectAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisappearAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的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;
}
示例2: slideTo
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
private void slideTo(int slideOffset, boolean forceInstant) {
if (animator != null) {
animator.cancel();
animator = null;
}
if (!forceInstant) {
animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(400);
animator.start();
ViewCompat.postInvalidateOnAnimation(this);
} else {
this.slideOffset = slideOffset;
requestLayout();
invalidate();
}
}
示例3: createCircularReveal
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
/**
* Returns an Animator which can animate a clipping circle.
* <p/>
* Any shadow cast by the View will respect the circular clip from this animator.
* <p/>
* Only a single non-rectangular clip can be applied on a View at any time.
* Views clipped by a circular reveal animation take priority over
* {@link View#setClipToOutline(boolean) View Outline clipping}.
* <p/>
* Note that the animation returned here is a one-shot animation. It cannot
* be re-used, and once started it cannot be paused or resumed.
*
* @param view The View will be clipped to the animating circle.
* @param centerX The x coordinate of the center of the animating circle.
* @param centerY The y coordinate of the center of the animating circle.
* @param startRadius The starting radius of the animating circle.
* @param endRadius The ending radius of the animating circle.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SupportAnimator createCircularReveal(View view,
int centerX, int centerY,
float startRadius, float endRadius) {
if (!(view.getParent() instanceof RevealAnimator)) {
throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
}
RevealAnimator revealLayout = (RevealAnimator) view.getParent();
revealLayout.attachRevealInfo(new RevealInfo(centerX, centerY, startRadius, endRadius,
new WeakReference<>(view)));
if (LOLLIPOP_PLUS) {
return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
.createCircularReveal(view, centerX, centerY, startRadius, endRadius), revealLayout);
}
ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS,
startRadius, endRadius);
reveal.addListener(getRevealFinishListener(revealLayout));
return new SupportAnimatorPreL(reveal, revealLayout);
}
示例4: getPulseAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的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;
}
示例5: reverseDiscAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
private void reverseDiscAnimator() {
mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator arg0) {
mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
}
});
mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());
if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
mDiscLayoutAnimator.cancel();
}
mDiscLayoutAnimator.start();
}
示例6: onStateChange
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
@Override
protected void onStateChange(int state) {
this.state = state;
ObjectAnimator.clearAllAnimations();
stateImg.setVisibility(View.INVISIBLE);
progress.setVisibility(View.INVISIBLE);
ViewHelper.setAlpha(progress, 1f);
switch (state) {
case NONE:
break;
case PULLING:
break;
case LOOSENT_O_LOAD:
break;
case LOADING:
AnimUtil.startShow(progress, 0.1f, 200, 0);
AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1);
break;
case LOAD_CLONE:
AnimUtil.startShow(stateImg, 0.1f, 400, 200);
AnimUtil.startHide(progress);
break;
}
}
示例7: onStateChange
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
@Override
protected void onStateChange(int state) {
this.state = state;
ObjectAnimator.clearAllAnimations();
stateImg.setVisibility(View.INVISIBLE);
progress.setVisibility(View.VISIBLE);
ViewHelper.setAlpha(progress, 1f);
switch (state) {
case NONE:
break;
case PULLING:
break;
case LOOSENT_O_REFRESH:
break;
case REFRESHING:
AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1);
break;
case REFRESH_CLONE:
AnimUtil.startShow(stateImg, 0.1f, 400, 200);
AnimUtil.startHide(progress);
break;
}
}
示例8: startNeedleAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
private void startNeedleAnimator() {
if (isPlaying) {
mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", 0, NEEDLE_ROTATE_CIRCLE);
} else {
mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", NEEDLE_ROTATE_CIRCLE, 0);
}
mNeedleAnimator.setDuration(NEEDLE_ANIMATOR_TIME);
mNeedleAnimator.setInterpolator(new DecelerateInterpolator());
if (mNeedleAnimator.isRunning() || mNeedleAnimator.isStarted()) {
mNeedleAnimator.cancel();
}
mNeedleAnimator.start();
}
示例9: dismissShowdown
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
/**
* 隐藏模糊背景
*/
protected void dismissShowdown() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
objectAnimator.setDuration(400);
objectAnimator.start();
objectAnimator.addListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animator animation) {
mParentVG.removeView(mBg);
}
});
}
示例10: initData
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
@Override
protected void initData(Context context) {
super.initData(context);
// creating animators
mDimSelectorWheelAnimator = ObjectAnimator.ofFloat(this, PROPERTY_SELECTOR_PAINT_COEFF, 1, 0);
mDimSeparatorsAnimator = ObjectAnimator.ofInt(this, PROPERTY_SEPARATORS_PAINT_ALPHA,
mSelectionDividerActiveAlpha, mSelectionDividerDimmedAlpha
);
// creating paints
mSeparatorsPaint = new Paint();
mSeparatorsPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mSeparatorsPaint.setAlpha(mSelectionDividerDimmedAlpha);
mSelectorWheelPaint = new Paint();
mSelectorWheelPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
}
示例11: rotate
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
/**
* Animates transition between current rotation to target rotation
*
* @param fromRotation
* @param toRotation
* @param duration
* @param interpolator
* @param isFrom
* @return
*/
@NonNull
public Animator rotate(float fromRotation, float toRotation, float duration, @Nullable Interpolator interpolator, boolean isFrom) {
Animator animator;
if (isFrom) {
animator = ObjectAnimator.ofFloat(mView, "rotation", toRotation, fromRotation);
} else {
animator = ObjectAnimator.ofFloat(mView, "rotation", fromRotation, toRotation);
}
setProperties(animator, duration, interpolator);
return animator;
}
示例12: animateView
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
private void animateView(final ViewGroup parent, final View view) {
if (mAnimationStartMillis == -1) {
mAnimationStartMillis = System.currentTimeMillis();
}
ViewHelper.setAlpha(view, 0);
Animator[] childAnimators;
if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
} else {
childAnimators = new Animator[0];
}
Animator[] animators = getAnimators(parent, view);
Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
AnimatorSet set = new AnimatorSet();
set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
set.setStartDelay(calculateAnimationDelay());
set.setDuration(getAnimationDurationMillis());
set.start();
mAnimators.put(view.hashCode(), set);
}
示例13: alpha
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
/**
* Animates transition between current alpha to target alpha
*
* @param fromAlpha
* @param toAlpha
* @param duration
* @param interpolator
* @param isFrom
* @return
*/
@NonNull
public Animator alpha(float fromAlpha, float toAlpha, float duration, @Nullable Interpolator interpolator, boolean isFrom) {
Animator animator;
if (isFrom) {
animator = ObjectAnimator.ofFloat(mView, "alpha", toAlpha, fromAlpha);
} else {
animator = ObjectAnimator.ofFloat(mView, "alpha", fromAlpha, toAlpha);
}
setProperties(animator, duration, interpolator);
return animator;
}
示例14: onCollapseAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
public void onCollapseAnimator(AnimatorSet animatorSet) {
int count = this.contentView.getChildCount();
for(int i = 0; i < count; ++i) {
View rootView = this.contentView.getChildAt(i);
ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
if(null == iconIv) {
return;
}
ObjectAnimator animator = new ObjectAnimator();
animator.setTarget(iconIv);
animator.setFloatValues(new float[]{0.0F, 45.0F});
animator.setPropertyName("rotation");
animator.setInterpolator(this.mOvershootInterpolator);
//animator.setStartDelay((long)(count * i * 20));
animatorSet.playTogether(new Animator[]{animator});
}
}
示例15: showShowdown
import com.nineoldandroids.animation.ObjectAnimator; //导入依赖的package包/类
/**
* 显示模糊背景
*/
protected void showShowdown() {
ViewHelper.setTranslationY(mRootView, 0);
mEffect.effect(mParentVG,mBg);
ViewGroup.LayoutParams lp =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
if(mBg.getParent()!= null){
mParentVG.removeView(mBg);
}
mParentVG.addView(mBg, lp);
ViewHelper.setAlpha(mBg, 0);
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 0, 1);
objectAnimator.setDuration(400);
objectAnimator.start();
}