android.animation.ObjectAnimator Java Examples
The following examples show how to use
android.animation.ObjectAnimator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Case1Scene.java From scene with Apache License 2.0 | 7 votes |
@NonNull @Override protected Animator onPopAnimator(final AnimationInfo fromInfo, final AnimationInfo toInfo) { final View toView = toInfo.mSceneView; final View fromView = fromInfo.mSceneView; ValueAnimator fromAlphaAnimator = ObjectAnimator.ofFloat(fromView, View.ALPHA, 1.0f, 0.0f); fromAlphaAnimator.setInterpolator(new LinearInterpolator()); fromAlphaAnimator.setDuration(150 * 20); fromAlphaAnimator.setStartDelay(50 * 20); ValueAnimator fromTranslateAnimator = ObjectAnimator.ofFloat(fromView, View.TRANSLATION_Y, 0, 0.08f * toView.getHeight()); fromTranslateAnimator.setInterpolator(new AccelerateInterpolator(2)); fromTranslateAnimator.setDuration(200 * 20); ValueAnimator toAlphaAnimator = ObjectAnimator.ofFloat(toView, View.ALPHA, 0.7f, 1.0f); toAlphaAnimator.setInterpolator(new LinearOutSlowInInterpolator()); toAlphaAnimator.setDuration(20 * 20); return TransitionUtils.mergeAnimators(fromAlphaAnimator, fromTranslateAnimator, toAlphaAnimator); }
Example #2
Source File: PathAnimation.java From XDroidAnimation with Apache License 2.0 | 6 votes |
@Override public AnimatorSet createAnimatorSet() { ViewHelper.setClipChildren(targetView, false); if (path == null) { throw new IllegalArgumentException("You have to set up a AnimatorPath for PathAnimation!"); } ObjectAnimator anim = ObjectAnimator.ofObject(this, "ViewLoc", new PathEvaluator(), path.getPoints().toArray()); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(anim); animatorSet.setDuration(duration); animatorSet.setInterpolator(interpolator); if (listener != null) { animatorSet.addListener(listener); } return animatorSet; }
Example #3
Source File: DrawerLayoutContainer.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void openDrawer(boolean fast) { if (!allowOpenDrawer) { return; } if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) { AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus()); } cancelCurrentAnimation(); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(this, "drawerPosition", drawerLayout.getMeasuredWidth())); animatorSet.setInterpolator(new DecelerateInterpolator()); if (fast) { animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * (drawerLayout.getMeasuredWidth() - drawerPosition)), 50)); } else { animatorSet.setDuration(250); } animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { onDrawerAnimationEnd(true); } }); animatorSet.start(); currentAnimation = animatorSet; }
Example #4
Source File: ChannelAdminLogActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void hideFloatingDateView(boolean animated) { if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) { floatingDateView.setTag(null); if (animated) { floatingDateAnimation = new AnimatorSet(); floatingDateAnimation.setDuration(150); floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f)); floatingDateAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (animation.equals(floatingDateAnimation)) { floatingDateAnimation = null; } } }); floatingDateAnimation.setStartDelay(500); floatingDateAnimation.start(); } else { if (floatingDateAnimation != null) { floatingDateAnimation.cancel(); floatingDateAnimation = null; } floatingDateView.setAlpha(0.0f); } } }
Example #5
Source File: CategoryPropertyEditor.java From edslite with GNU General Public License v2.0 | 6 votes |
private void rotateIconAndChangeState() { IS_ANIMATING = true; _indicatorIcon.clearAnimation(); ObjectAnimator anim = ObjectAnimator.ofFloat(_indicatorIcon, View.ROTATION, _isExpanded ? 0 : 180); anim.setDuration(200); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) _indicatorIcon.setHasTransientState(true); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if(_isExpanded) collapse(); else expand(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) _indicatorIcon.setHasTransientState(false); IS_ANIMATING = false; } }); anim.start(); }
Example #6
Source File: InfoBarContainerLayout.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override Animator createAnimator() { int deltaHeight = mNewContents.getHeight() - mOldContents.getHeight(); InfoBarContainerLayout.this.setTranslationY(Math.max(0, deltaHeight)); mNewContents.setAlpha(0f); AnimatorSet animator = new AnimatorSet(); animator.playSequentially( ObjectAnimator.ofFloat(mOldContents, View.ALPHA, 0f) .setDuration(DURATION_FADE_OUT_MS), ObjectAnimator.ofFloat(InfoBarContainerLayout.this, View.TRANSLATION_Y, Math.max(0, -deltaHeight)).setDuration(DURATION_SLIDE_UP_MS), ObjectAnimator.ofFloat(mNewContents, View.ALPHA, 1f) .setDuration(DURATION_FADE_OUT_MS)); return animator; }
Example #7
Source File: HSVPickerView.java From ColorPickerDialog with Apache License 2.0 | 6 votes |
@Override public void setColor(int color, boolean animate) { super.setColor(color, animate); SeekBar[] bars = new SeekBar[]{hue, saturation, brightness}; float[] values = new float[3]; Color.colorToHSV(color, values); values[1] *= 255; values[2] *= 255; for (int i = 0; i < bars.length; i++) { if (animate && !isTrackingTouch) { ObjectAnimator animator = ObjectAnimator.ofInt(bars[i], "progress", (int) values[i]); animator.setInterpolator(new DecelerateInterpolator()); animator.start(); } else { bars[i].setProgress((int) values[i]); } } updateProgressBars(); }
Example #8
Source File: RxAdapterUpDownStackAnimator.java From RxTools-master with Apache License 2.0 | 6 votes |
@Override protected void itemCollapseAnimatorSet(RxCardStackView.ViewHolder viewHolder) { int childTop = mRxCardStackView.getPaddingTop(); for (int i = 0; i < mRxCardStackView.getChildCount(); i++) { View child = mRxCardStackView.getChildAt(i); child.clearAnimation(); final RxCardStackView.LayoutParams lp = (RxCardStackView.LayoutParams) child.getLayoutParams(); childTop += lp.topMargin; if (i != 0) { childTop -= mRxCardStackView.getOverlapGaps() * 2; } ObjectAnimator oAnim = ObjectAnimator.ofFloat(child, View.Y, child.getY(), childTop - mRxCardStackView.getRxScrollDelegate().getViewScrollY() < mRxCardStackView.getChildAt(0).getY() ? mRxCardStackView.getChildAt(0).getY() : childTop - mRxCardStackView.getRxScrollDelegate().getViewScrollY()); mSet.play(oAnim); childTop += lp.mHeaderHeight; } }
Example #9
Source File: ToolbarPhone.java From 365browser with Apache License 2.0 | 6 votes |
private ObjectAnimator createExitTabSwitcherAnimation( final boolean animateNormalToolbar) { ObjectAnimator exitAnimation = ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 0.f); exitAnimation.setDuration(animateNormalToolbar ? TAB_SWITCHER_MODE_EXIT_NORMAL_ANIMATION_DURATION_MS : TAB_SWITCHER_MODE_EXIT_FADE_ANIMATION_DURATION_MS); exitAnimation.setInterpolator(new LinearInterpolator()); exitAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { updateViewsForTabSwitcherMode(); } }); return exitAnimation; }
Example #10
Source File: PagedView.java From TurboLauncher with Apache License 2.0 | 6 votes |
void animateDragViewToOriginalPosition() { if (mDragView != null) { AnimatorSet anim = new AnimatorSet(); anim.setDuration(REORDERING_DROP_REPOSITION_DURATION); anim.playTogether( ObjectAnimator.ofFloat(mDragView, "translationX", 0f), ObjectAnimator.ofFloat(mDragView, "translationY", 0f), ObjectAnimator.ofFloat(mDragView, "scaleX", 1f), ObjectAnimator.ofFloat(mDragView, "scaleY", 1f)); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { onPostReorderingAnimationCompleted(); } }); anim.start(); } }
Example #11
Source File: ShotDetailsActivity.java From droidddle with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void updateStatusBarColor() { if (mShotFragment == null || true) { return; } final int desiredStatusBarColor; // Only use a custom status bar color if QuickContacts touches the top of the viewport. if (/*mScroller.getScrollNeededToBeFullScreen() <= 0*/ true) { desiredStatusBarColor = mStatusBarColor; } else { desiredStatusBarColor = Color.TRANSPARENT; } // Animate to the new color. if (UiUtils.hasLollipop()) { final ObjectAnimator animation = ObjectAnimator.ofInt(getWindow(), "statusBarColor", getWindow().getStatusBarColor(), desiredStatusBarColor); animation.setDuration(ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION); animation.setEvaluator(new ArgbEvaluator()); animation.start(); } }
Example #12
Source File: ContentItemLoadingStateFactory.java From empty-state-recyclerview with MIT License | 6 votes |
@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(); } } }
Example #13
Source File: ChartAnimator.java From android-kline with Apache License 2.0 | 5 votes |
/** * Animates the rendering of the chart on the x-axis with the specified * animation time. If animate(...) is called, no further calling of * invalidate() is necessary to refresh the chart. * * @param durationMillis */ public void animateX(int durationMillis) { if (android.os.Build.VERSION.SDK_INT < 11) return; ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f); animatorX.setDuration(durationMillis); animatorX.addUpdateListener(mListener); animatorX.start(); }
Example #14
Source File: VolumeSliderView.java From FuckingVolumeSlider with GNU General Public License v3.0 | 5 votes |
private void initAnimator() { mPressAnimator = ObjectAnimator.ofFloat(this, DEGREE, 0, -45); mPressAnimator.setDuration(1000); mUpAnimator = new AnimatorSet(); mDegreeAnimator = new ObjectAnimator(); mDegreeAnimator.setTarget(this); mDegreeAnimator.setProperty(DEGREE); mBallAnimator = new ObjectAnimator(); mBallAnimator.setTarget(this); mBallAnimator.setProperty(BALLLOCATION); mUpAnimator.playTogether(mDegreeAnimator, mBallAnimator); }
Example #15
Source File: TransactionHistoryFragment.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
private void initRotation(ImageView ivLoader) { if (loaderAnimation == null) { loaderAnimation = ObjectAnimator.ofFloat(ivLoader, "rotation", 0.0f, 360f); loaderAnimation.setDuration(1500); loaderAnimation.setRepeatCount(ObjectAnimator.INFINITE); loaderAnimation.setInterpolator(new LinearInterpolator()); loaderAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationCancel(animation); tvUpdateTransactions.setClickable(true); } }); } }
Example #16
Source File: SlideLeftExit.java From FlycoDialog_Master with MIT License | 5 votes |
@Override public void setAnimation(View view) { DisplayMetrics dm = view.getContext().getResources().getDisplayMetrics(); animatorSet.playTogether(// ObjectAnimator.ofFloat(view, "translationX", 0, -250 * dm.density), // ObjectAnimator.ofFloat(view, "alpha", 1, 0)); }
Example #17
Source File: LocationBarTablet.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * @param button The {@link View} of the button to hide. * @return An animator to run for the given view when hiding buttons in the unfocused location * bar. This should also be used to create animators for hiding toolbar buttons. */ public ObjectAnimator createHideButtonAnimator(View button) { ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(button, View.ALPHA, 0.f); buttonAnimator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); buttonAnimator.setDuration(ICON_FADE_ANIMATION_DURATION_MS); return buttonAnimator; }
Example #18
Source File: Jelly.java From FlycoDialog_Master with MIT License | 5 votes |
@Override public void setAnimation(View view) { animatorSet.playTogether(// ObjectAnimator.ofFloat(view, "scaleX", 0.3f, 0.5f, 0.9f, 0.8f, 0.9f, 1),// ObjectAnimator.ofFloat(view, "scaleY", 0.3f, 0.5f, 0.9f, 0.8f, 0.9f, 1),// ObjectAnimator.ofFloat(view, "alpha", 0.2f, 1)); }
Example #19
Source File: AbsQuizView.java From android-topeka with Apache License 2.0 | 5 votes |
private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) { ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale); animator.setInterpolator(mLinearOutSlowInInterpolator); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset); animator.start(); }
Example #20
Source File: AnimatorAnimationFactory.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void animateTargetToPoint(ShowcaseView showcaseView, Point point) { AnimatorSet set = new AnimatorSet(); ObjectAnimator xAnimator = ObjectAnimator.ofInt(showcaseView, "showcaseX", point.x); ObjectAnimator yAnimator = ObjectAnimator.ofInt(showcaseView, "showcaseY", point.y); set.playTogether(xAnimator, yAnimator); set.setInterpolator(interpolator); set.start(); }
Example #21
Source File: MainActivity.java From BlurView with Apache License 2.0 | 5 votes |
private void initViews() { mBlurView = findViewById(R.id.blurView); mTextView = (TextView) findViewById(R.id.blurTextView); mImageView = (ImageView) findViewById(R.id.imageView); mImageView.getViewTreeObserver().addOnPreDrawListener( new OnPreDrawListener() { @Override public boolean onPreDraw() { mImageView.getViewTreeObserver() .removeOnPreDrawListener(this); // 加载背景图构建Bitmap mImageView.buildDrawingCache(); // 获取ImageView缓存的Bitmap Bitmap bmp = mImageView.getDrawingCache(); // 在异步任务中执行模糊 new BlurTask().execute(bmp); return true; } }); // 图片缩放动画 ObjectAnimator imageAnimator = ObjectAnimator.ofFloat(mImageView, "scaleX", 1.0f, 1.1f).setDuration(2000); ObjectAnimator imageAnimator1 = ObjectAnimator.ofFloat(mImageView, "scaleY", 1.0f, 1.1f).setDuration(2000); imageAnimator.start(); imageAnimator1.start(); imageAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { textAnimation(); } }); // 由于图片放大相应的模糊的View也需要同样放大 mBlurView.setScaleX(1.1f); mBlurView.setScaleY(1.1f); }
Example #22
Source File: ZoomInEnter.java From FlycoDialog_Master with MIT License | 5 votes |
@Override public void setAnimation(View view) { animatorSet.playTogether(// ObjectAnimator.ofFloat(view, "scaleX", 0.5f, 1),// ObjectAnimator.ofFloat(view, "scaleY", 0.5f, 1),// ObjectAnimator.ofFloat(view, "alpha", 0, 1));// }
Example #23
Source File: VoIPActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@SuppressLint("ObjectAnimatorBinding") private ObjectAnimator createAlphaAnimator(Object target, int startVal, int endVal, int startDelay, int duration) { ObjectAnimator a = ObjectAnimator.ofInt(target, "alpha", startVal, endVal); a.setDuration(duration); a.setStartDelay(startDelay); a.setInterpolator(CubicBezierInterpolator.DEFAULT); return a; }
Example #24
Source File: TakingOffAnimator.java From KUtils-master with Apache License 2.0 | 5 votes |
@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)) ); }
Example #25
Source File: AnimUtils.java From PictureSelector with Apache License 2.0 | 5 votes |
public static void zoom(View view, boolean isZoomAnim) { if (isZoomAnim) { AnimatorSet set = new AnimatorSet(); set.playTogether( ObjectAnimator.ofFloat(view, "scaleX", 1f, 1.12f), ObjectAnimator.ofFloat(view, "scaleY", 1f, 1.12f) ); set.setDuration(DURATION); set.start(); } }
Example #26
Source File: MoreMenuHelper.java From Android_UE with Apache License 2.0 | 5 votes |
/** * 旋转菜单按钮 */ private void rotationActionMenu(int from, int to) { ValueAnimator fadeAnim = ObjectAnimator.ofFloat(fabCloseMoreMenu, "rotation", from, to); fadeAnim.setDuration(300); KickBackAnimator kickAnimator = new KickBackAnimator(); kickAnimator.setDuration(150); fadeAnim.setEvaluator(kickAnimator); fadeAnim.start(); }
Example #27
Source File: CircleAnimatedCheckBox.java From actor-platform with GNU Affero General Public License v3.0 | 5 votes |
private void init(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setBackground(null); } d = context.getResources().getDrawable(R.drawable.ic_check_white_18dp); circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); circlePaint.setStyle(Paint.Style.STROKE); backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); backgroundPaint.setStyle(Paint.Style.FILL); circlePaint.setStrokeWidth(pressedRingWidth); animator = ObjectAnimator.ofFloat(this, "animationProgress", 0f, 1f); }
Example #28
Source File: X8AiHeadLockExcuteController.java From FimiX8-RE with MIT License | 5 votes |
public void openNextUi() { this.nextRootView.setVisibility(0); this.blank.setVisibility(0); if (!this.isNextShow) { this.isNextShow = true; this.width = X8Application.ANIMATION_WIDTH; ObjectAnimator animatorY = ObjectAnimator.ofFloat(this.nextRootView, "translationX", new float[]{(float) this.width, 0.0f}); animatorY.setDuration(300); animatorY.start(); } this.activity.taskFullScreen(true); }
Example #29
Source File: FlatPlayerPlaybackControlsFragment.java From VinylMusicPlayer with GNU General Public License v3.0 | 5 votes |
private static void addAnimation(Collection<Animator> animators, View view, TimeInterpolator interpolator, int duration, int delay) { Animator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, 0f, 1f); scaleX.setInterpolator(interpolator); scaleX.setDuration(duration); scaleX.setStartDelay(delay); animators.add(scaleX); Animator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, 0f, 1f); scaleY.setInterpolator(interpolator); scaleY.setDuration(duration); scaleY.setStartDelay(delay); animators.add(scaleY); }
Example #30
Source File: Attention.java From android-animations with MIT License | 5 votes |
public static AnimatorSet Tada(View view){ AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "scaleX", 1, 0.9f, 0.9f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1); ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "scaleY", 1, 0.9f, 0.9f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1); ObjectAnimator object3 = ObjectAnimator.ofFloat(view, "rotation", 0, -3, -3, 3, -3, 3, -3, 3, -3, 0); animatorSet.playTogether(object1, object2, object3); return animatorSet; }