Java Code Examples for com.nineoldandroids.animation.ObjectAnimator#ofFloat()
The following examples show how to use
com.nineoldandroids.animation.ObjectAnimator#ofFloat() .
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: FragmentMusicView.java From Pas with Apache License 2.0 | 6 votes |
@Override public void initWeidget() { ButterKnife.bind(this, getRootView()); //ivicon旋转 animator = ObjectAnimator.ofFloat(ivIcon, "rotation", 0, 360); animator.setDuration(15000); animator.setInterpolator(new LinearInterpolator()); animator.setRepeatCount(ValueAnimator.INFINITE); //透明度动画 animator1 = ObjectAnimator.ofFloat(rlBg, "alpha", 0.2f, 1.0f); animator1.setDuration(2000); animator1.setInterpolator(new AccelerateDecelerateInterpolator()); }
Example 2
Source File: ViewAnimationUtils.java From fab-toolbar with MIT License | 6 votes |
/** * 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 android.view.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); }
Example 3
Source File: ClusterTransitionsAnimation.java From clusterkraf with Apache License 2.0 | 6 votes |
void animate(ClusterTransitions transitions) { if (this.state == null) { Options options = optionsRef.get(); Host host = hostRef.get(); if (options != null && host != null) { this.state = new AnimatedTransitionState(transitions.animated); this.transitions = transitions; animator = ObjectAnimator.ofFloat(this.state, "value", 0f, 1f); animator.addListener(this); animator.addUpdateListener(this); animator.setDuration(options.getTransitionDuration()); animator.setInterpolator(options.getTransitionInterpolator()); host.onClusterTransitionStarting(); animator.start(); } } }
Example 4
Source File: SwipeTouchListener.java From ListViewAnimations with Apache License 2.0 | 6 votes |
/** * Flings given {@link android.view.View} out of sight. * * @param view the parent {@link android.view.View}. * @param position the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}. * @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left. */ private void flingView(@NonNull final View view, final int position, final boolean flingToRight) { if (mViewWidth < 2) { mViewWidth = mListViewWrapper.getListView().getWidth(); } View swipeView = getSwipeView(view); ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(xAnimator, alphaAnimator); animatorSet.setDuration(mAnimationTime); animatorSet.addListener(new FlingAnimatorListener(view, position)); animatorSet.start(); }
Example 5
Source File: MaterialAutoCompleteTextView.java From XERUNG with Apache License 2.0 | 5 votes |
private ObjectAnimator getBottomLinesAnimator(float destBottomLines) { if (bottomLinesAnimator == null) { bottomLinesAnimator = ObjectAnimator.ofFloat(this, "currentBottomLines", destBottomLines); } else { bottomLinesAnimator.cancel(); bottomLinesAnimator.setFloatValues(destBottomLines); } return bottomLinesAnimator; }
Example 6
Source File: Switch.java From MoeGallery with GNU General Public License v3.0 | 5 votes |
public void animateCheck() { changeBackground(); ObjectAnimator objectAnimator; if (eventCheck) { objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin); } else { objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni); } objectAnimator.setDuration(300); objectAnimator.start(); }
Example 7
Source File: ViewAnimationUtils.java From Jide-Note with MIT License | 5 votes |
/** * 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 android.view.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(LOLLIPOP_PLUS){ return new SupportAnimatorLollipop(android.view.ViewAnimationUtils .createCircularReveal(view, centerX, centerY, startRadius, endRadius)); } if(!(view.getParent() instanceof RevealAnimator)){ throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout."); } RevealAnimator revealLayout = (RevealAnimator) view.getParent(); revealLayout.setTarget(view); revealLayout.setCenter(centerX, centerY); Rect bounds = new Rect(); view.getHitRect(bounds); ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, "revealRadius", startRadius, endRadius); reveal.addListener(getRevealFinishListener(revealLayout, bounds)); return new SupportAnimatorPreL(reveal); }
Example 8
Source File: SwitchAnimationUtil.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void runAlphaAnimation(View view, long delay) { view.setAlpha(0); ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha", 0, 1); objectAnimator.setStartDelay(delay); objectAnimator.setDuration(mDuration); objectAnimator.setInterpolator(new LinearInterpolator()); objectAnimator.start(); }
Example 9
Source File: SwitchAnimationUtil.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void runFlipHorizonAnimation(View view, long delay) { view.setAlpha(0); AnimatorSet set = new AnimatorSet(); ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(view, "rotationY", -180f, 0f); ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); set.setDuration(mDuration); set.playTogether(objectAnimator1, objectAnimator2); set.setStartDelay(delay); set.start(); }
Example 10
Source File: DetailActivity.java From google-io-2014-compat with Apache License 2.0 | 5 votes |
private void createShrinkAnimation(final SpotlightView spotlight) { mapContainer.setVisibility(View.INVISIBLE); spotlight.setVisibility(View.VISIBLE); hero.setVisibility(View.VISIBLE); spotlight.setMaskScale(maskScale); ObjectAnimator superShrink = ObjectAnimator.ofFloat(spotlight, "maskScale", maskScale, 0.5f); superShrink.addListener(new AnimatorListener() { @Override public void onAnimationEnd(Animator animation) { spotlight.setVisibility(View.GONE); } }); superShrink.start(); }
Example 11
Source File: CircleImageView.java From CircleImageView with Apache License 2.0 | 5 votes |
private void init(Context context, AttributeSet attrs, int defStyleAttr) { setClickable(true); // Load the styled attributes and set their properties TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyleAttr, 0); mBackgroundColor = attributes.getColor(R.styleable.CircleImageView_view_backgroundColor, context.getResources().getColor(android.R.color.transparent)); mBorderColor = attributes.getColor(R.styleable.CircleImageView_view_borderColor, DEFAULT_BORDER_COLOR); mBorderWidth = attributes.getDimensionPixelOffset(R.styleable.CircleImageView_view_borderWidth, DEFAULT_BORDER_WIDTH); mBorderSelectedColor = attributes.getColor(R.styleable.CircleImageView_view_selectedColor, DEFAULT_BORDER_SELECTED_COLOR); mShadowRadius = attributes.getDimension(R.styleable.CircleImageView_view_shadowRadius, DEFAULT_SHADOW_RADIUS); mShadowColor = attributes.getColor(R.styleable.CircleImageView_view_shadowColor, DEFAULT_SHADOW_COLOR); mShadowDx = attributes.getDimension(R.styleable.CircleImageView_view_shadowDx, DEFAULT_SHADOW_DX); mShadowDy = attributes.getDimension(R.styleable.CircleImageView_view_shadowDy, DEFAULT_SHADOW_DY); mPressedRingWidth = (int) attributes.getDimension(R.styleable.CircleImageView_view_pressedRingWidth, DEFAULT_PRESSED_RING_WIDTH); mPressedRingColor = attributes.getColor(R.styleable.CircleImageView_view_pressedRingColor, DEFAULT_PRESSED_RING_COLOR); attributes.recycle(); //Init pressed animation mPressedAnimator = ObjectAnimator.ofFloat(this, ANIMATION_PROGRESS_ATTR, 0f, 0f); mPressedAnimator.setDuration(getResources().getInteger(ANIMATION_TIME)); // Init paint mPaintImage = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintBorder = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintBackground = new Paint(Paint.ANTI_ALIAS_FLAG); //background color setBackgroundColor(mBackgroundColor); //border color setBorderColor(mBorderColor); //border width setBorderWidth(mBorderWidth); //shadow radius, color, dx, dy drawShadow(mShadowRadius, mShadowColor, mShadowDx, mShadowDy); }
Example 12
Source File: Switch.java From meiShi with Apache License 2.0 | 5 votes |
public void animateCheck() { changeBackground(); ObjectAnimator objectAnimator; if (eventCheck) { objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin); } else { objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni); } objectAnimator.setDuration(300); objectAnimator.start(); }
Example 13
Source File: MaterialEditText.java From XERUNG with Apache License 2.0 | 5 votes |
private ObjectAnimator getBottomLinesAnimator(float destBottomLines) { if (bottomLinesAnimator == null) { bottomLinesAnimator = ObjectAnimator.ofFloat(this, "currentBottomLines", destBottomLines); } else { bottomLinesAnimator.cancel(); bottomLinesAnimator.setFloatValues(destBottomLines); } return bottomLinesAnimator; }
Example 14
Source File: MaterialMultiAutoCompleteTextView.java From arcusandroid with Apache License 2.0 | 5 votes |
private ObjectAnimator getLabelAnimator() { if (labelAnimator == null) { labelAnimator = ObjectAnimator.ofFloat(this, "floatingLabelFraction", 0f, 1f); } labelAnimator.setDuration(floatingLabelAnimating ? 300 : 0); return labelAnimator; }
Example 15
Source File: AnimUtil.java From PullRefreshView with Apache License 2.0 | 5 votes |
public static Animator startShow(View view, float fromAlpha) { ViewHelper.setAlpha(view, fromAlpha); view.setVisibility(View.VISIBLE); Animator animator = ObjectAnimator.ofFloat(view, "alpha", fromAlpha, 1f); animator.start(); return animator; }
Example 16
Source File: MaterialAutoCompleteTextView.java From Mover with Apache License 2.0 | 4 votes |
private ObjectAnimator getLabelAnimator() { if (labelAnimator == null) { labelAnimator = ObjectAnimator.ofFloat(this, "floatingLabelFraction", 0f, 1f); } return labelAnimator; }
Example 17
Source File: MaterialEditText.java From arcusandroid with Apache License 2.0 | 4 votes |
private ObjectAnimator getLabelFocusAnimator() { if (labelFocusAnimator == null) { labelFocusAnimator = ObjectAnimator.ofFloat(this, "focusFraction", 0f, 1f); } return labelFocusAnimator; }
Example 18
Source File: ScaleInAnimationAdapter.java From UltimateAndroid with Apache License 2.0 | 4 votes |
@Override public Animator[] getAnimators(final ViewGroup parent, final View view) { ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, SCALE_X, mScaleFrom, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, SCALE_Y, mScaleFrom, 1f); return new ObjectAnimator[]{scaleX, scaleY}; }
Example 19
Source File: MaterialSpinner.java From XERUNG with Apache License 2.0 | 4 votes |
private void initFloatingLabelAnimator() { if (floatingLabelAnimator == null) { floatingLabelAnimator = ObjectAnimator.ofFloat(this, "floatingLabelPercent", 0f, 1f); floatingLabelAnimator.addUpdateListener(this); } }
Example 20
Source File: CustomDelegate.java From MousePaint with MIT License | 3 votes |
private void alphaAnimation() { ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getContentRelativeLayout(), "alpha", 0, 1); objectAnimator.setDuration(1200); objectAnimator.setInterpolator(new DecelerateInterpolator()); objectAnimator.start(); }