List of usage examples for android.animation ObjectAnimator ofFloat
public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> property, float... values)
From source file:Main.java
public static ObjectAnimator translateToastByX(View view, float x, int duration, Interpolator interpolator) { ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationX", x); objectAnimator.setDuration(duration); objectAnimator.setInterpolator(interpolator); objectAnimator.start();/*from w w w . j a va 2 s . co m*/ return objectAnimator; }
From source file:Main.java
public static ObjectAnimator translateToastByY(View view, float y, int duration, Interpolator interpolator) { ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationY", y); objectAnimator.setDuration(duration); objectAnimator.setInterpolator(interpolator); objectAnimator.start();// ww w. j av a 2 s . co m return objectAnimator; }
From source file:Main.java
public static Animator animFadeIn(View view) { ObjectAnimator objectanimator = ObjectAnimator.ofFloat(view, "alpha", new float[] { 0.3F, 1.0F }); objectanimator.setInterpolator(new AccelerateInterpolator()); return objectanimator; }
From source file:Main.java
private static AnimatorSet buildMenuAnimation(View target, float alpha, int animationDuration) { AnimatorSet alphaAnimation = new AnimatorSet(); alphaAnimation.playTogether(ObjectAnimator.ofFloat(target, "alpha", alpha)); alphaAnimation.setDuration(animationDuration); return alphaAnimation; }
From source file:Main.java
private static ObjectAnimator animateFloatProperty(Object target, String propertyName, int time, float... value) { ObjectAnimator oa = ObjectAnimator.ofFloat(target, propertyName, value); oa.setDuration(time);//from www . j a v a2 s . c o m return oa; }
From source file:Main.java
public static void animateScaleIn(View view, long duration, Animator.AnimatorListener listener) { view.setScaleX(0f);/*w w w . j av a 2 s .com*/ view.setScaleY(0f); view.setVisibility(View.VISIBLE); AnimatorSet scaleSet = new AnimatorSet(); scaleSet.playTogether(ObjectAnimator.ofFloat(view, View.SCALE_X, 1f), ObjectAnimator.ofFloat(view, View.SCALE_Y, 1f)); scaleSet.setInterpolator(new AccelerateDecelerateInterpolator()); scaleSet.setDuration(duration); if (listener != null) { scaleSet.addListener(listener); } scaleSet.start(); //return scaleSet; }
From source file:Main.java
public static ValueAnimator getAlphaAnimator(View view, float... values) { return ObjectAnimator.ofFloat(view, View.ALPHA, values); }
From source file:com.dbychkov.words.behavior.ScrollOffBottomBehavior.java
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { if (animator == null || !animator.isRunning()) { int totalScroll = (dyConsumed + dyUnconsumed); int targetTranslation = totalScroll > 0 ? viewHeight : 0; animator = ObjectAnimator.ofFloat(child, "translationY", targetTranslation * TRANSLATION_MULTIPLIER); animator.start();/*from ww w .j a v a 2s . com*/ } }
From source file:com.android.clear.reminder.ItemAnimator.java
@Override public boolean animateRemove(final ViewHolder holder) { endAnimation(holder);//from w w w.j av a 2 s . c om final float prevAlpha = holder.itemView.getAlpha(); final Animator removeAnimator = ObjectAnimator.ofFloat(holder.itemView, View.ALPHA, 0f); removeAnimator.setDuration(getRemoveDuration()); removeAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(Animator animator) { animator.removeAllListeners(); mAnimators.remove(holder); holder.itemView.setAlpha(prevAlpha); dispatchRemoveFinished(holder); } }); mRemoveAnimatorsList.add(removeAnimator); mAnimators.put(holder, removeAnimator); return true; }
From source file:com.github.rubensousa.floatingtoolbar.FloatingAnimatorImpl.java
@Override public void show() { super.show(); int rootWidth = getRootView().getWidth(); float endFabX; if (getFab().getLeft() > rootWidth / 2f) { endFabX = getFab().getLeft() - getFab().getWidth(); } else {// w w w . j ava 2 s . c o m endFabX = getFab().getLeft() + getFab().getWidth(); } PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(View.X, endFabX); PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(View.Y, getFloatingToolbar().getY() * 0.95f); PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(View.SCALE_X, 0); PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getFab(), xProperty, yProperty, scaleXProperty, scaleYProperty); animator.setDuration(FAB_MORPH_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getFloatingToolbar(), "scaleX", 1f); objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION); objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { getFloatingToolbar().setVisibility(View.VISIBLE); getFab().setVisibility(View.INVISIBLE); } }); objectAnimator.start(); }