public void applyBadgeState(ItemInfo itemInfo, boolean animate) {
if (mIcon instanceof FastBitmapDrawable) {
boolean wasBadged = mBadgeInfo != null;
mBadgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
boolean isBadged = mBadgeInfo != null;
float newBadgeScale = isBadged ? 1f : 0;
mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
if (wasBadged || isBadged) {
mBadgePalette = ((FastBitmapDrawable) mIcon).getIconPalette();
// Animate when a badge is first added or when it is removed.
if (animate && (wasBadged ^ isBadged) && isShown()) {
ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start();
} else {
mBadgeScale = newBadgeScale;
invalidate();
}
}
}
}
java类android.animation.ObjectAnimator的实例源码
BubbleTextView.java 文件源码
项目:LaunchEnr
阅读 37
收藏 0
点赞 0
评论 0
DemoLikeTumblrActivity.java 文件源码
项目:ArcLayout-master
阅读 39
收藏 0
点赞 0
评论 0
private Animator createShowItemAnimator(View item) {
float dx = centerItem.getX() - item.getX();
float dy = centerItem.getY() - item.getY();
item.setScaleX(0f);
item.setScaleY(0f);
item.setTranslationX(dx);
item.setTranslationY(dy);
Animator anim = ObjectAnimator.ofPropertyValuesHolder(
item,
AnimatorUtils.scaleX(0f, 1f),
AnimatorUtils.scaleY(0f, 1f),
AnimatorUtils.translationX(dx, 0f),
AnimatorUtils.translationY(dy, 0f)
);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration(50);
return anim;
}
CustormAnim.java 文件源码
项目:LiveGiftLayout
阅读 33
收藏 0
点赞 0
评论 0
@NonNull
private AnimatorSet testAnim(GiftFrameLayout giftFrameLayout) {
PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0, -50);
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.5f);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
animator.setStartDelay(0);
animator.setDuration(1500);
translationY = PropertyValuesHolder.ofFloat("translationY", -50, -100);
alpha = PropertyValuesHolder.ofFloat("alpha", 0.5f, 0f);
ObjectAnimator animator1 = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
animator1.setStartDelay(0);
animator1.setDuration(1500);
// 复原
// ObjectAnimator fadeAnimator2 = GiftAnimationUtil.createFadeAnimator(giftFrameLayout, 0, 0, 0, 0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(animator1).after(animator);
// animatorSet.play(fadeAnimator2).after(animator1);
animatorSet.start();
return animatorSet;
}
ZoomIndicator.java 文件源码
项目:ViewPagerHelper
阅读 34
收藏 0
点赞 0
评论 0
/**
* 用于小圆点的放大缩小
* @param view
* @param type
*/
private void targetViewAnim(final View view, final int type){
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator scaleX = null;
ObjectAnimator scaleY = null;
ObjectAnimator alpha = null;
if (type == ANIM_OUT){
scaleX = ObjectAnimator.ofFloat(view,"scaleX",SCALE_MIN,mScale_max);
scaleY = ObjectAnimator.ofFloat(view,"scaleY",SCALE_MIN,mScale_max);
alpha = ObjectAnimator.ofFloat(view,"alpha",mAlpha_min,ALPHA_MAX);
animatorSet.setDuration(ANIM_OUT_TIME);
}else{
scaleX = ObjectAnimator.ofFloat(view,"scaleX",mScale_max,SCALE_MIN);
scaleY = ObjectAnimator.ofFloat(view,"scaleY",mScale_max,SCALE_MIN);
alpha = ObjectAnimator.ofFloat(view,"alpha",ALPHA_MAX,mAlpha_min);
animatorSet.setDuration(ANIM_IN_TIME);
}
animatorSet.play(scaleX).with(scaleY).with(alpha);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.start();
}
EmptyView.java 文件源码
项目:RLibrary
阅读 37
收藏 0
点赞 0
评论 0
private void initAnimator() {
if (mObjectAnimator == null) {
mObjectAnimator = ObjectAnimator.ofInt(3, 6);
mObjectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (int) animation.getAnimatedValue();
if (value != last) {
last = value;
factor = last / 10f;
L.e("call: onAnimationUpdate([animation])-> " + factor);
postInvalidate();
}
}
});
mObjectAnimator.setRepeatCount(ValueAnimator.INFINITE);
mObjectAnimator.setRepeatMode(ValueAnimator.REVERSE);
mObjectAnimator.setDuration(300);
mObjectAnimator.start();
}
}
FlipY.java 文件源码
项目:Flubber
阅读 24
收藏 0
点赞 0
评论 0
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
final float startRotation = view.getRotationY();
final float endRotation = startRotation + 180f;
final PropertyValuesHolder rotationPVH =
PropertyValuesHolder.ofFloat(View.ROTATION_Y, startRotation, endRotation);
final ObjectAnimator animation =
ObjectAnimator.ofPropertyValuesHolder(view, rotationPVH);
return animation;
}
AuthRefreshRecyclerFragment.java 文件源码
项目:GitHub
阅读 23
收藏 0
点赞 0
评论 0
@Override public void showContent() {
if (adapter.getItemCount() == 0) {
if (isRestoringViewState()) {
emptyView.setVisibility(View.VISIBLE);
} else {
ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
anim.setStartDelay(250);
anim.addListener(new AnimatorListenerAdapter() {
@Override public void onAnimationStart(Animator animation) {
emptyView.setVisibility(View.VISIBLE);
}
});
anim.start();
}
} else {
emptyView.setVisibility(View.GONE);
}
super.showContent();
}
ObjectAnimationActivity2.java 文件源码
项目:MaterialDesignDemo
阅读 26
收藏 0
点赞 0
评论 0
public void startSecondAnimation(View view) {
ObjectAnimator rotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 0f, 25f);
ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(mView1, "alpha", 0.5f, 1f);
ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(mView1, "scaleX", 0.8f, 1f);
ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(mView1, "scaleY", 0.8f, 1f);
ObjectAnimator translationYAnimation = ObjectAnimator.ofFloat(mView1, "translationY", -0.1f * mView1.getHeight(), 0f);
ObjectAnimator rerotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 25f, 0f);
rerotationXAnimation.setStartDelay(200);
ObjectAnimator translationYAnimation2 = ObjectAnimator.ofFloat(mView2, "translationY", 0, mView2.getHeight());
translationYAnimation2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mView2.setVisibility(View.INVISIBLE);
}
});
AnimatorSet as = new AnimatorSet();
as.playTogether(rotationXAnimation, alphaAnimation, scaleXAnimation, scaleYAnimation,
translationYAnimation,
rerotationXAnimation, translationYAnimation2);
as.setDuration(200);
as.start();
}
AbstractContentLoadingState.java 文件源码
项目:empty-state-recyclerview
阅读 40
收藏 0
点赞 0
评论 0
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
final int width = rv.getMeasuredWidth();
final int height = rv.getMeasuredHeight();
// Draw all of our content items
renderContent(numberOfContentItems, width, height, canvas, contentPaint);
// Setup and start animation, if possible
if (animateContentItems) {
if (anim == null) {
this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
onInterceptAnimatorCreation(anim);
this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
rv.invalidate();
}
});
this.anim.start();
}
}
}
ViewHolderAnimationHelper.java 文件源码
项目:gmlrva
阅读 21
收藏 0
点赞 0
评论 0
/**
* Procedure meant to execute a change animation for the desired {@link RecyclerView.ViewHolder}.
* @param holder the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
* @param itemView the {@link RecyclerView.ViewHolder}'s root view.
* @param listener the {@link GenericItemAnimator} instance orchestrating the animations.
* @return the resulting {@link AnimatorSet} for the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
*/
public static AnimatorSet runTestChangeAnimation(@NonNull final RecyclerView.ViewHolder holder,
@NonNull final View itemView,
@NonNull final GenericItemAnimator listener) {
final ObjectAnimator oldTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, 0, 90);
final ObjectAnimator newTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, -90, 0);
final AnimatorSet textAnim = new AnimatorSet();
textAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(@NonNull final Animator animation) {
listener.onAnimationFinished(holder, CHANGE_ANIMATION_FINISHED);
}
});
textAnim.playSequentially(oldTextRotate, newTextRotate);
return textAnim;
}
DownUpActivity.java 文件源码
项目:SunmiUI
阅读 23
收藏 0
点赞 0
评论 0
/**
* 隐藏下面的菜单
*/
private void hide() {
rel.startAnimation(mHiddenAction);
rel.setVisibility(View.INVISIBLE);
mFloatingActionsMenu.startAnimation(mHiddenAction1);
mFloatingActionsMenu.setVisibility(View.INVISIBLE);
animatorHeadHide = ObjectAnimator.ofFloat(vvv, "translationY", 0, -headHight);
animatorHeadHide.setDuration(666);
animatorHeadHide.start();
animatorHeadHide.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Log.e("lllxxx",animation.getAnimatedValue()+"===");
linearParams.height = headHight+(int)((float)animation.getAnimatedValue());
head.setLayoutParams(linearParams);
}
});
}
QMUIAnimationListView.java 文件源码
项目:QMUI_Android
阅读 31
收藏 0
点赞 0
评论 0
protected ObjectAnimator alphaObjectAnimator(View view, final boolean fadeIn, long duration, boolean postBack) {
final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", fadeIn ? new float[]{
0f, 1f} : new float[]{1f, 0f});
anim.setDuration(duration);
if (postBack) {
final WeakReference<View> wr = new WeakReference<>(view);
anim.addListener(new ManipulateAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
if (wr.get() != null) {
wr.get().setAlpha(fadeIn ? 0 : 1);
}
}
});
}
return anim;
}
AnimHelper.java 文件源码
项目:mvvm-template
阅读 33
收藏 0
点赞 0
评论 0
@UiThread public static void startBeatsAnimation(@NonNull View view) {
view.clearAnimation();
if (view.getAnimation() != null) {
view.getAnimation().cancel();
}
List<ObjectAnimator> animators = getBeats(view);
for (ObjectAnimator anim : animators) {
anim.setDuration(300).start();
anim.setInterpolator(interpolator);
}
}
CharaView.java 文件源码
项目:KokoWalk
阅读 31
收藏 0
点赞 0
评论 0
public void moveAbsolute(View v, float addX, float addY, float rad, int mSec) {
if(addX > mCurrentX)mDirection = 1;
else mDirection = 0;
PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", mCurrentX, addX);
PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", mCurrentY, addY);
PropertyValuesHolder holderRotaion = PropertyValuesHolder.ofFloat("rotation", mCurrentRad, mCurrentRad + rad);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(v, holderX, holderY, holderRotaion);
objectAnimator.setDuration(mSec);
mCurrentX = addX;
mCurrentY = addY;
mCurrentRad = (mCurrentRad + rad) % 360;
objectAnimator.start();
}
SampleActivity.java 文件源码
项目:DragPointView
阅读 48
收藏 0
点赞 0
评论 0
private void initAnim() {
animationDrawable = new AnimationDrawable();
animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode1), 100);
animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode2), 100);
animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode3), 100);
animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode4), 100);
animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode5), 100);
animationDrawable.setOneShot(true);
animationDrawable.setExitFadeDuration(300);
animationDrawable.setEnterFadeDuration(100);
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(null, "scaleX", 1.f, 0.f);
ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(null, "scaleY", 1.f, 0.f);
animatorSet = new AnimatorSet();
animatorSet.setDuration(300l);
animatorSet.playTogether(objectAnimator1, objectAnimator2);
objectAnimator = ObjectAnimator.ofFloat(null, "alpha", 1.f, 0.f);
objectAnimator.setDuration(2000l);
}
PhotoPaintView.java 文件源码
项目:PlusGram
阅读 32
收藏 0
点赞 0
评论 0
private void closeStickersView() {
if (stickersView == null || stickersView.getVisibility() != VISIBLE) {
return;
}
pickingSticker = false;
Animator a = ObjectAnimator.ofFloat(stickersView, "alpha", 1.0f, 0.0f);
a.setDuration(200);
a.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animator) {
stickersView.setVisibility(GONE);
}
});
a.start();
undoItem.setVisibility(VISIBLE);
actionBar.setTitle(LocaleController.getString("PaintDraw", R.string.PaintDraw));
}
ExpandButtonLayout.java 文件源码
项目:ExpandButton
阅读 42
收藏 0
点赞 0
评论 0
public void close() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", mLinearLayoutWidth, 0);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
PullToZoomScrollView.java 文件源码
项目:boohee_v5.6
阅读 33
收藏 0
点赞 0
评论 0
private void reset() {
if (this.mAnimator == null || !this.mAnimator.isRunning()) {
this.mAnimator = ObjectAnimator.ofInt(this, "t", new int[]{((int) (-this.distance)) /
4, 0});
this.mAnimator.setDuration(150);
this.mAnimator.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
PullToZoomScrollView.this.isPreparePull = false;
if (PullToZoomScrollView.this.distance / aj.hA > ((float)
PullToZoomScrollView.this.DEFAULT_PULL_HEIGHT)) {
if (PullToZoomScrollView.this.onPullToZoomListener != null) {
PullToZoomScrollView.this.onPullToZoomListener.onPull();
}
} else if (PullToZoomScrollView.this.onPullToZoomListener != null) {
PullToZoomScrollView.this.onPullToZoomListener.onCancelPull();
}
}
});
this.mAnimator.start();
}
}
BottomMenu.java 文件源码
项目:72GGames_Demo
阅读 36
收藏 0
点赞 0
评论 0
public void selectMenu(){
tvMenu.setVisibility(INVISIBLE);
ivIcon.setImageResource(selectIconId);
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(null,"xxx",0,1).setDuration(300);
objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float progress = (float) animation.getAnimatedValue();
setPivotX(getWidth()/2);
setPivotY(0);
setScaleX(1+progress*THRESHOLD);
setScaleY(1+progress*THRESHOLD);
}
});
objectAnimator.start();
}
DrawerLayoutContainer.java 文件源码
项目:airgram
阅读 25
收藏 0
点赞 0
评论 0
public void closeDrawer(boolean fast) {
cancelCurrentAnimation();
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(
ObjectAnimator.ofFloat(this, "drawerPosition", 0)
);
animatorSet.setInterpolator(new DecelerateInterpolator());
if (fast) {
animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * drawerPosition), 50));
} else {
animatorSet.setDuration(300);
}
animatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animator) {
onDrawerAnimationEnd(false);
}
});
animatorSet.start();
}
VideoPlayActivity.java 文件源码
项目:boohee_v5.6
阅读 40
收藏 0
点赞 0
评论 0
private void updateProgress() {
if (this.progressAnimator != null && this.progressAnimator.isRunning()) {
this.progressAnimator.end();
}
double progress = (double) (((this.mentionIndex * 1000) + ((this.playCountNum * 1000) /
this.currentMention.number)) / this.totalMetionCount);
this.progressAnimator = ObjectAnimator.ofInt(this.progressBar, "progress", new int[]{
(int) progress});
if (this.currentMention.is_times) {
this.progressAnimator.setDuration(((long) this.currentMention.rate) * 1000);
} else {
this.progressAnimator.setDuration(1000);
}
this.progressAnimator.setInterpolator(new LinearInterpolator());
this.progressAnimator.start();
}
DotsFragment.java 文件源码
项目:Material-Motion
阅读 45
收藏 0
点赞 0
评论 0
private AnimatorSet morphParent(int duration){
GradientDrawable drawable=GradientDrawable.class.cast(parent.getBackground());
int endValue=isFolded?getResources().getDimensionPixelOffset(R.dimen.morph_radius):0;
ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(drawable, "cornerRadius", endValue);
endValue=isFolded?parent.getHeight()/2:parent.getHeight()*2;
ValueAnimator heightAnimation = ValueAnimator.ofInt(parent.getHeight(),endValue);
heightAnimation.addUpdateListener(valueAnimator-> {
int val = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = parent.getLayoutParams();
layoutParams.height = val;
parent.setLayoutParams(layoutParams);
});
cornerAnimation.setDuration(duration);
heightAnimation.setDuration(duration);
AnimatorSet set=new AnimatorSet();
set.playTogether(cornerAnimation,heightAnimation);
return set;
}
RotateInDownRightAnimator.java 文件源码
项目:KUtils
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void prepare(View target) {
float x = target.getWidth() - target.getPaddingRight();
float y = target.getHeight() - target.getPaddingBottom();
getAnimatorAgent().playTogether(
ObjectAnimator.ofFloat(target, "rotation", 90, 0),
ObjectAnimator.ofFloat(target, "alpha", 0, 1),
ObjectAnimator.ofFloat(target, "pivotX", x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y)
);
}
FastScroller.java 文件源码
项目:Rey-MusicPlayer
阅读 29
收藏 0
点赞 0
评论 0
private void showBubble() {
bubble.setVisibility(VISIBLE);
showViews();
if (currentAnimator != null)
currentAnimator.cancel();
currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
currentAnimator.start();
}
Selector.java 文件源码
项目:PDialogs-Android
阅读 33
收藏 0
点赞 0
评论 0
public void select(@Nullable String selectTitle) {
ObjectAnimator colorAnim = ObjectAnimator.ofInt(binding.textViewDialogSelector
, "textColor", binding.textViewDialogSelector.getCurrentTextColor(), ContextCompat.getColor(context, R.color.accentColor));
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
binding.iconImgv.setImageResource(selectedIcon);
binding.textViewDialogSelector.setText(selectTitle);
binding.selectorImgv.setImageResource(R.drawable.ic_previous_selected_p_dialog);
binding.selectorRly.setBackgroundResource(R.drawable.border_radius_20_selected_p_dialog);
isSelected = true;
}
HingeAnimator.java 文件源码
项目:KUtils-master
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void prepare(View target) {
float x = target.getPaddingLeft();
float y = target.getPaddingTop();
getAnimatorAgent().playTogether(
Glider.glide(Skill.SineEaseInOut, 1300, ObjectAnimator.ofFloat(target, "rotation", 0, 80, 60, 80, 60, 60)),
ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700),
ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0),
ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y)
);
setDuration(1300);
}
MainActivity.java 文件源码
项目:DizzyPassword
阅读 30
收藏 0
点赞 0
评论 0
private void startAnim() {
animator = ObjectAnimator.ofFloat(refresh, "rotation", 0f, 360.0f);
animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator());//不停顿
animator.setRepeatCount(-1);//设置动画重复次数
animator.setRepeatMode(ValueAnimator.RESTART);//动画重复模式
startAnimation(animator);
}
RadialSelectorView.java 文件源码
项目:TimePicker
阅读 32
收藏 0
点赞 0
评论 0
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;
}
TakingOffAnimator.java 文件源码
项目:KUtils-master
阅读 25
收藏 0
点赞 0
评论 0
@Override
protected void prepare(View target) {
getAnimatorAgent().playTogether(
Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "scaleX", 1f, 1.5f)),
Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "scaleY", 1f, 1.5f)),
Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "alpha", 1, 0))
);
}
RoundView.java 文件源码
项目:buildAPKsSamples
阅读 36
收藏 0
点赞 0
评论 0
public ObjectAnimator getScalingAnimator() {
PropertyValuesHolder imgViewScaleY = PropertyValuesHolder.ofFloat(View
.SCALE_Y, SCALE_FACTOR);
PropertyValuesHolder imgViewScaleX = PropertyValuesHolder.ofFloat(View
.SCALE_X, SCALE_FACTOR);
ObjectAnimator imgViewScaleAnimator = ObjectAnimator
.ofPropertyValuesHolder(this, imgViewScaleX, imgViewScaleY);
imgViewScaleAnimator.setRepeatCount(1);
imgViewScaleAnimator.setRepeatMode(ValueAnimator.REVERSE);
imgViewScaleAnimator.setDuration(ANIMATION_DURATION);
return imgViewScaleAnimator;
}