Here are the examples of the java api android.animation.PropertyValuesHolder.ofFloat() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
170 Examples
19
Source : Pop.java
with Apache License 2.0
from yongjhih
with Apache License 2.0
from yongjhih
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.ALPHA, 0f), PropertyValuesHolder.ofFloat(View.SCALE_X, 0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f));
}
19
Source : DefaultAnimations.java
with MIT License
from willowtreeapps
with MIT License
from willowtreeapps
public static Animator shrinkAnimator(View view, long duration) {
return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.SCALE_X, SHRINK_SCALE, ORIGINAL_SCALE), PropertyValuesHolder.ofFloat(View.SCALE_Y, SHRINK_SCALE, ORIGINAL_SCALE)).setDuration(duration);
}
19
Source : DefaultAnimations.java
with MIT License
from willowtreeapps
with MIT License
from willowtreeapps
public static Animator growAnimator(View view, long duration) {
return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.SCALE_X, GROW_SCALE, ORIGINAL_SCALE), PropertyValuesHolder.ofFloat(View.SCALE_Y, GROW_SCALE, ORIGINAL_SCALE)).setDuration(duration);
}
19
Source : LineAnimator.java
with Apache License 2.0
from varunest
with Apache License 2.0
from varunest
private void playWhiteLineForward(final LocalCallback callback) {
initLineCoordinates(true);
ValueAnimator va11, va12, va21, va22, va31, va32;
PropertyValuesHolder px1 = PropertyValuesHolder.ofFloat("X", x1, x2);
PropertyValuesHolder py1 = PropertyValuesHolder.ofFloat("Y", y1, y2);
PropertyValuesHolder px2 = PropertyValuesHolder.ofFloat("X", x2, x3);
PropertyValuesHolder py2 = PropertyValuesHolder.ofFloat("Y", y2, y3);
PropertyValuesHolder px3 = PropertyValuesHolder.ofFloat("X", x3, x4);
PropertyValuesHolder py3 = PropertyValuesHolder.ofFloat("Y", y3, y4);
va11 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va11.setInterpolator(new AccelerateInterpolator(1.8f));
va11.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa12 = (float) valueAnimator.getAnimatedValue("X");
wya12 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va12 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va12.setInterpolator(new AccelerateInterpolator(1.8f));
va12.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa11 = (float) valueAnimator.getAnimatedValue("X");
wya11 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va21 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va21.setInterpolator(new AccelerateInterpolator(1.8f));
va21.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa22 = (float) valueAnimator.getAnimatedValue("X");
wya22 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va22 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va22.setInterpolator(new AccelerateInterpolator(1.8f));
va22.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa21 = (float) valueAnimator.getAnimatedValue("X");
wya21 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va31 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va31.setInterpolator(new DecelerateInterpolator(1.8f));
va31.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa32 = (float) valueAnimator.getAnimatedValue("X");
wya32 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va32 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va32.setInterpolator(new DecelerateInterpolator(1.8f));
va32.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa31 = (float) valueAnimator.getAnimatedValue("X");
wya31 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
int tw11 = 450;
int tw21 = 143;
int tw31 = 510;
va11.setDuration(tw11);
va21.setDuration(tw21);
va31.setDuration(tw31);
va21.setStartDelay(tw11);
va31.setStartDelay(tw11 + tw21);
int tw12 = 510;
int tw22 = 165;
int tw32 = 433;
va12.setDuration(tw12);
va22.setDuration(tw22);
va32.setDuration(tw32);
va22.setStartDelay(tw12);
va32.setStartDelay(tw12 + tw22);
va11.start();
va12.start();
va21.start();
va22.start();
va31.start();
va32.start();
va12.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.startFirstCircleAnimation(x2, y2);
}
});
va22.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.startSecondCircleAnimation(x3, y3);
}
});
va32.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.onComplete();
}
});
}
19
Source : LineAnimator.java
with Apache License 2.0
from varunest
with Apache License 2.0
from varunest
private void playRedLineBackward(final LocalCallback callback) {
initLineCoordinates(false);
ValueAnimator va11, va12, va21, va22, va31, va32;
PropertyValuesHolder px1 = PropertyValuesHolder.ofFloat("X", x4, x3);
PropertyValuesHolder py1 = PropertyValuesHolder.ofFloat("Y", y4, y3);
PropertyValuesHolder px2 = PropertyValuesHolder.ofFloat("X", x3, x2);
PropertyValuesHolder py2 = PropertyValuesHolder.ofFloat("Y", y3, y2);
PropertyValuesHolder px3 = PropertyValuesHolder.ofFloat("X", x2, x1);
PropertyValuesHolder py3 = PropertyValuesHolder.ofFloat("Y", y2, y1);
va11 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va11.setInterpolator(new AccelerateInterpolator(1.8f));
va11.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa32 = (float) valueAnimator.getAnimatedValue("X");
rya32 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va12 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va12.setInterpolator(new AccelerateInterpolator(1.8f));
va12.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa31 = (float) valueAnimator.getAnimatedValue("X");
rya31 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va21 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va21.setInterpolator(new AccelerateInterpolator(1.8f));
va21.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa22 = (float) valueAnimator.getAnimatedValue("X");
rya22 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va22 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va22.setInterpolator(new AccelerateInterpolator(1.8f));
va22.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa21 = (float) valueAnimator.getAnimatedValue("X");
rya21 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va31 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va31.setInterpolator(new DecelerateInterpolator(1.8f));
va31.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa12 = (float) valueAnimator.getAnimatedValue("X");
rya12 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va32 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va32.setInterpolator(new DecelerateInterpolator(1.8f));
va32.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa11 = (float) valueAnimator.getAnimatedValue("X");
rya11 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
int tw11 = 450;
int tw21 = 143;
int tw31 = 510;
va11.setDuration(tw11);
va21.setDuration(tw21);
va31.setDuration(tw31);
va21.setStartDelay(tw11);
va31.setStartDelay(tw11 + tw21);
int tw12 = 510;
int tw22 = 165;
int tw32 = 433;
va12.setDuration(tw12);
va22.setDuration(tw22);
va32.setDuration(tw32);
va22.setStartDelay(tw12);
va32.setStartDelay(tw12 + tw22);
va11.start();
va12.start();
va21.start();
va22.start();
va31.start();
va32.start();
va32.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.onComplete();
}
});
}
19
Source : LineAnimator.java
with Apache License 2.0
from varunest
with Apache License 2.0
from varunest
private void playRedLineForward(final LocalCallback callback) {
initLineCoordinates(true);
ValueAnimator va11, va12, va21, va22, va31, va32;
PropertyValuesHolder px1 = PropertyValuesHolder.ofFloat("X", x1, x2);
PropertyValuesHolder py1 = PropertyValuesHolder.ofFloat("Y", y1, y2);
PropertyValuesHolder px2 = PropertyValuesHolder.ofFloat("X", x2, x3);
PropertyValuesHolder py2 = PropertyValuesHolder.ofFloat("Y", y2, y3);
PropertyValuesHolder px3 = PropertyValuesHolder.ofFloat("X", x3, x4);
PropertyValuesHolder py3 = PropertyValuesHolder.ofFloat("Y", y3, y4);
va11 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va11.setInterpolator(new AccelerateInterpolator(1.8f));
va11.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa12 = (float) valueAnimator.getAnimatedValue("X");
rya12 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va12 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va12.setInterpolator(new AccelerateInterpolator(1.8f));
va12.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa11 = (float) valueAnimator.getAnimatedValue("X");
rya11 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va21 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va21.setInterpolator(new AccelerateInterpolator(1.8f));
va21.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa22 = (float) valueAnimator.getAnimatedValue("X");
rya22 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va22 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va22.setInterpolator(new AccelerateInterpolator(1.8f));
va22.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa21 = (float) valueAnimator.getAnimatedValue("X");
rya21 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va31 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va31.setInterpolator(new DecelerateInterpolator(1.8f));
va31.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa32 = (float) valueAnimator.getAnimatedValue("X");
rya32 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va32 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va32.setInterpolator(new DecelerateInterpolator(1.8f));
va32.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rxa31 = (float) valueAnimator.getAnimatedValue("X");
rya31 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
int tw11 = 450;
int tw21 = 143;
int tw31 = 510;
va11.setDuration(tw11);
va21.setDuration(tw21);
va31.setDuration(tw31);
va21.setStartDelay(tw11);
va31.setStartDelay(tw11 + tw21);
int tw12 = 510;
int tw22 = 165;
int tw32 = 433;
va12.setDuration(tw12);
va22.setDuration(tw22);
va32.setDuration(tw32);
va22.setStartDelay(tw12);
va32.setStartDelay(tw12 + tw22);
va11.start();
va12.start();
va21.start();
va22.start();
va31.start();
va32.start();
va32.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.onComplete();
}
});
}
19
Source : LineAnimator.java
with Apache License 2.0
from varunest
with Apache License 2.0
from varunest
private void playWhiteLineBackward(final LocalCallback callback) {
initLineCoordinates(false);
ValueAnimator va11, va12, va21, va22, va31, va32;
PropertyValuesHolder px1 = PropertyValuesHolder.ofFloat("X", x4, x3);
PropertyValuesHolder py1 = PropertyValuesHolder.ofFloat("Y", y4, y3);
PropertyValuesHolder px2 = PropertyValuesHolder.ofFloat("X", x3, x2);
PropertyValuesHolder py2 = PropertyValuesHolder.ofFloat("Y", y3, y2);
PropertyValuesHolder px3 = PropertyValuesHolder.ofFloat("X", x2, x1);
PropertyValuesHolder py3 = PropertyValuesHolder.ofFloat("Y", y2, y1);
va11 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va11.setInterpolator(new AccelerateInterpolator(1.8f));
va11.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa32 = (float) valueAnimator.getAnimatedValue("X");
wya32 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va12 = ValueAnimator.ofPropertyValuesHolder(px1, py1);
va12.setInterpolator(new AccelerateInterpolator(1.8f));
va12.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa31 = (float) valueAnimator.getAnimatedValue("X");
wya31 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va21 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va21.setInterpolator(new AccelerateInterpolator(1.8f));
va21.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa22 = (float) valueAnimator.getAnimatedValue("X");
wya22 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va22 = ValueAnimator.ofPropertyValuesHolder(px2, py2);
va22.setInterpolator(new AccelerateInterpolator(1.8f));
va22.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa21 = (float) valueAnimator.getAnimatedValue("X");
wya21 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va31 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va31.setInterpolator(new DecelerateInterpolator(1.8f));
va31.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa12 = (float) valueAnimator.getAnimatedValue("X");
wya12 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
va32 = ValueAnimator.ofPropertyValuesHolder(px3, py3);
va32.setInterpolator(new DecelerateInterpolator(1.8f));
va32.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
wxa11 = (float) valueAnimator.getAnimatedValue("X");
wya11 = (float) valueAnimator.getAnimatedValue("Y");
callback.onValueUpdated();
}
});
int tw11 = 450;
int tw21 = 143;
int tw31 = 510;
va11.setDuration(tw11);
va21.setDuration(tw21);
va31.setDuration(tw31);
va21.setStartDelay(tw11);
va31.setStartDelay(tw11 + tw21);
int tw12 = 510;
int tw22 = 165;
int tw32 = 433;
va12.setDuration(tw12);
va22.setDuration(tw22);
va32.setDuration(tw32);
va22.setStartDelay(tw12);
va32.setStartDelay(tw12 + tw22);
va11.start();
va21.start();
va31.start();
va12.start();
va22.start();
va32.start();
va12.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.startSecondCircleAnimation(x3, y3);
}
});
va22.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.startFirstCircleAnimation(x2, y2);
}
});
va32.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
callback.onComplete();
}
});
}
19
Source : ZoomRecyclerView.java
with MIT License
from ttdyce
with MIT License
from ttdyce
private void zoom(float startVal, float endVal) {
if (mScaleAnimator == null) {
newZoomAnimation();
}
if (mScaleAnimator.isRunning()) {
return;
}
// set Value
mMaxTranX = mViewWidth - (mViewWidth * endVal);
mMaxTranY = mViewHeight - (mViewHeight * endVal);
float startTranX = mTranX;
float startTranY = mTranY;
float endTranX = mTranX - (endVal - startVal) * mScaleCenterX;
float endTranY = mTranY - (endVal - startVal) * mScaleCenterY;
float[] correct = correctTranslateXY(endTranX, endTranY);
endTranX = correct[0];
endTranY = correct[1];
PropertyValuesHolder scaleHolder = PropertyValuesHolder.ofFloat(PROPERTY_SCALE, startVal, endVal);
PropertyValuesHolder tranXHolder = PropertyValuesHolder.ofFloat(PROPERTY_TRANX, startTranX, endTranX);
PropertyValuesHolder tranYHolder = PropertyValuesHolder.ofFloat(PROPERTY_TRANY, startTranY, endTranY);
mScaleAnimator.setValues(scaleHolder, tranXHolder, tranYHolder);
mScaleAnimator.setDuration(mScaleDuration);
mScaleAnimator.start();
}
19
Source : IndicatorDotView.java
with Apache License 2.0
from ronaldsmartin
with Apache License 2.0
from ronaldsmartin
/**
* Create the API-level appropriate animator for this indicator's reveal.
*
* @param centerX The X point from which the animation starts.
* @param centerY The Y point from which the animation starts.
*
* @see #revealAnimator()
*/
@NonNull
private Animator revealAnimator(int centerX, int centerY) {
final Animator animator;
/*
* The standard material circular reveal animation is exactly what we want.
*
* Since this view is already circular, a scale animation effectively simulates the
* material circular reveal on earlier API versions.
*/
final int oldScale = 0, newScale = 1;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator = ViewAnimationUtils.createCircularReveal(this, centerX, centerY, 0, dotRadius);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
final PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, oldScale, newScale);
final PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, oldScale, newScale);
animator = ObjectAnimator.ofPropertyValuesHolder(this, scaleX, scaleY);
} else {
final Animator scaleX = ObjectAnimator.ofFloat(this, "scaleX", oldScale, newScale);
final Animator scaleY = ObjectAnimator.ofFloat(this, "scaleY", oldScale, newScale);
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(scaleX, scaleY);
animator = animatorSet;
}
return animator;
}
19
Source : PagerLayout.java
with GNU General Public License v3.0
from Pradyuman7
with GNU General Public License v3.0
from Pradyuman7
private void initAnim() {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
float transX = (float) ((i + 1) * 0.06);
float transY = (float) ((i + 1) * 0.12);
ObjectAnimator animator;
@SuppressLint("ObjectAnimatorBinding")
PropertyValuesHolder valuesHolderX = PropertyValuesHolder.ofFloat("XFraction", 0, transX);
@SuppressLint("ObjectAnimatorBinding")
PropertyValuesHolder valuesHolderY = PropertyValuesHolder.ofFloat("YFraction", 0, transY);
animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderX, valuesHolderY);
animator.setInterpolator(interpolator);
animator.setDuration(300);
animators[i] = animator;
@SuppressLint("ObjectAnimatorBinding")
PropertyValuesHolder valuesHolderXReverse = PropertyValuesHolder.ofFloat("XFraction", transX, 1);
animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderXReverse);
animator.setInterpolator(interpolator);
animator.setDuration(300);
chosenAnimator[i] = animator;
@SuppressLint("ObjectAnimatorBinding")
PropertyValuesHolder valuesHolderAlpha = PropertyValuesHolder.ofFloat("menuAlpha", 1, 0);
animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderAlpha);
animator.setInterpolator(interpolator);
animator.setDuration(300);
menuAnimator[i] = animator;
}
}
19
Source : ChangeCounterValueAnimator.java
with MIT License
from n-apps
with MIT License
from n-apps
private void animateHolder(RecyclerView.ViewHolder holder, boolean isIncrease) {
AnimatorSet animatorSet = new AnimatorSet();
ArrayList<Animator> items = new ArrayList<>();
if (holder instanceof CountersAdapter.CounterFullViewHolder) {
CountersAdapter.CounterFullViewHolder h = (CountersAdapter.CounterFullViewHolder) holder;
ObjectAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(h.counterValue, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 0.87f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 0.87f, 1.0f));
scaleAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
scaleAnimator.setDuration(500);
items.add(scaleAnimator);
if (isIncrease) {
ObjectAnimator scaleArrowAnimator = ObjectAnimator.ofPropertyValuesHolder(h.increaseImageView, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
items.add(scaleArrowAnimator);
} else {
ObjectAnimator scaleArrowAnimator = ObjectAnimator.ofPropertyValuesHolder(h.decreaseImageView, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
items.add(scaleArrowAnimator);
}
animatorSet.playTogether(items);
animatorSet.start();
} else if (holder instanceof CountersAdapter.CounterCompactViewHolder) {
CountersAdapter.CounterCompactViewHolder h = (CountersAdapter.CounterCompactViewHolder) holder;
ObjectAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(h.counterValue, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 0.87f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 0.87f, 1.0f));
scaleAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
scaleAnimator.setDuration(500);
items.add(scaleAnimator);
if (isIncrease) {
ObjectAnimator scaleArrowAnimator = ObjectAnimator.ofPropertyValuesHolder(h.increaseImageView, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
items.add(scaleArrowAnimator);
} else {
ObjectAnimator scaleArrowAnimator = ObjectAnimator.ofPropertyValuesHolder(h.decreaseImageView, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
items.add(scaleArrowAnimator);
}
animatorSet.playTogether(items);
animatorSet.start();
}
}
19
Source : ScaleProvider.java
with Apache License 2.0
from material-components
with Apache License 2.0
from material-components
private static Animator createScaleAnimator(final View view, float startScale, float endScale) {
final float originalScaleX = view.getScaleX();
final float originalScaleY = view.getScaleY();
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.SCALE_X, originalScaleX * startScale, originalScaleX * endScale), PropertyValuesHolder.ofFloat(View.SCALE_Y, originalScaleY * startScale, originalScaleY * endScale));
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setScaleX(originalScaleX);
view.setScaleY(originalScaleY);
}
});
return animator;
}
19
Source : LauncherAnimUtils.java
with GNU General Public License v3.0
from LawnchairLauncher
with GNU General Public License v3.0
from LawnchairLauncher
public static ObjectAnimator ofViewAlphaAndScale(View target, float alpha, float scaleX, float scaleY) {
return ofPropertyValuesHolder(target, PropertyValuesHolder.ofFloat(View.ALPHA, alpha), PropertyValuesHolder.ofFloat(View.SCALE_X, scaleX), PropertyValuesHolder.ofFloat(View.SCALE_Y, scaleY));
}
19
Source : PropertyListBuilder.java
with GNU General Public License v3.0
from LawnchairLauncher
with GNU General Public License v3.0
from LawnchairLauncher
public PropertyListBuilder scaleX(float f) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_X, f));
return this;
}
19
Source : PropertyListBuilder.java
with GNU General Public License v3.0
from LawnchairLauncher
with GNU General Public License v3.0
from LawnchairLauncher
public PropertyListBuilder scaleY(float f) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_Y, f));
return this;
}
19
Source : WidgetsFullSheet.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
private void open(boolean animate) {
if (animate) {
if (mLauncher.getDragLayer().getInsets().bottom > 0) {
mContent.setAlpha(0);
setTranslationShift(VERTICAL_START_POSITION);
}
mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).setInterpolator(AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.linear_out_slow_in));
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mRecyclerView.setLayoutFrozen(false);
mAdapter.setApplyBitmapDeferred(false, mRecyclerView);
mOpenCloseAnimator.removeListener(this);
}
});
post(() -> {
mRecyclerView.setLayoutFrozen(true);
mOpenCloseAnimator.start();
mContent.animate().alpha(1).setDuration(FADE_IN_DURATION);
});
} else {
setTranslationShift(TRANSLATION_SHIFT_OPENED);
mAdapter.setApplyBitmapDeferred(false, mRecyclerView);
post(this::announceAccessibilityChanges);
}
}
19
Source : WidgetsBottomSheet.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
private void animateOpen() {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
}
mIsOpen = true;
setupNavBarColor();
mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
mOpenCloseAnimator.start();
}
19
Source : BottomUserEducationView.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
private void open(boolean animate) {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
}
mIsOpen = true;
if (animate) {
mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
mOpenCloseAnimator.start();
} else {
setTranslationShift(TRANSLATION_SHIFT_OPENED);
}
}
19
Source : PropertyListBuilder.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
public PropertyListBuilder scaleY(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_Y, value));
return this;
}
19
Source : PropertyListBuilder.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
public PropertyListBuilder alpha(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.ALPHA, value));
return this;
}
19
Source : PropertyListBuilder.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
public PropertyListBuilder scaleX(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_X, value));
return this;
}
19
Source : LiveRoomActivity.java
with Apache License 2.0
from hpdx
with Apache License 2.0
from hpdx
private void scale(float ratio) {
if (scaleRatio == ratio) {
return;
}
if (scaleAnimator != null) {
scaleAnimator.cancel();
}
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", scaleRatio, ratio);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", scaleRatio, ratio);
PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat("translationX", 0);
PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0);
scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mVideoView, scaleX, scaleY, translationX, translationY);
scaleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animation.removeAllListeners();
scaleAnimator = null;
}
});
scaleAnimator.setDuration(150L).start();
scaleRatio = ratio;
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder scaleX(float... values) {
return PropertyValuesHolder.ofFloat(SCALE_X, values);
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder rotation(float... values) {
return PropertyValuesHolder.ofFloat(ROTATION, values);
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder scaleY(float... values) {
return PropertyValuesHolder.ofFloat(SCALE_Y, values);
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder alpha(float... values) {
return PropertyValuesHolder.ofFloat(ALPHA, values);
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder translationY(float... values) {
return PropertyValuesHolder.ofFloat(TRANSLATION_Y, values);
}
19
Source : AnimatorUtils.java
with Apache License 2.0
from HackPlan
with Apache License 2.0
from HackPlan
private static PropertyValuesHolder translationX(float... values) {
return PropertyValuesHolder.ofFloat(TRANSLATION_X, values);
}
19
Source : FlowerGiftView.java
with Apache License 2.0
from FreeSunny
with Apache License 2.0
from FreeSunny
@NonNull
private ObjectAnimator getFlyFade() {
PropertyValuesHolder flyUp = PropertyValuesHolder.ofFloat("translationY", 0, left2Right ? -transY : transY);
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1, 0);
return ObjectAnimator.ofPropertyValuesHolder(this, flyUp, alpha).setDuration(500);
}
19
Source : CustormAnim.java
with Apache License 2.0
from DyncKathline
with Apache License 2.0
from DyncKathline
@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;
}
19
Source : GiftAnimationUtil.java
with Apache License 2.0
from DyncKathline
with Apache License 2.0
from DyncKathline
/**
* @param target
* @param star
* @param end
* @param duration
* @param startDelay
* @return 向上飞 淡出
*/
public static ObjectAnimator createFadeAnimator(final View target, float star, float end, int duration, int startDelay) {
PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", star, end);
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0f);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, translationY, alpha);
animator.setStartDelay(startDelay);
animator.setDuration(duration);
return animator;
}
19
Source : GiftAnimationUtil.java
with Apache License 2.0
from DyncKathline
with Apache License 2.0
from DyncKathline
/**
* @param target
* @return 送礼数字变化
*/
public static ObjectAnimator scaleGiftNum(final TextView target) {
PropertyValuesHolder anim4 = PropertyValuesHolder.ofFloat("scaleX", 1.2f, 0.8f, 1f);
PropertyValuesHolder anim5 = PropertyValuesHolder.ofFloat("scaleY", 1.2f, 0.8f, 1f);
PropertyValuesHolder anim6 = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0f, 1f);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, anim4, anim5, anim6).setDuration(400);
return animator;
}
19
Source : StackViewAnimation.java
with Apache License 2.0
from derry
with Apache License 2.0
from derry
private Animator createNewTabOpenedAnimator(StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) {
Tab tab = model.getTabAt(focusIndex);
if (tab == null || !tab.isNativePage())
return null;
View view = tab.getView();
if (view == null)
return null;
// Set up the view hierarchy
if (view.getParent() != null)
((ViewGroup) view.getParent()).removeView(view);
ViewGroup bgView = new FrameLayout(view.getContext());
bgView.setBackgroundColor(tab.getBackgroundColor());
bgView.addView(view);
container.addView(bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// Update any compositor state that needs to change
if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) {
tabs[focusIndex].setAlpha(0.f);
}
// Build the view animations
PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f);
PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f);
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(bgView, xScale, yScale, alpha);
animator.setDuration(TAB_OPENED_ANIMATION_DURATION);
animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE);
float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx;
bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP);
bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx);
return animator;
}
19
Source : DefaultCardStreamAnimator.java
with Apache License 2.0
from android
with Apache License 2.0
from android
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY) {
float deltaXAbs = Math.abs(deltaX);
float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));
// Animate position and alpha of swiped item
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1.f), PropertyValuesHolder.ofFloat("translationX", 0.f), PropertyValuesHolder.ofFloat("rotationY", 0.f));
animator.setDuration(duration).setInterpolator(new BounceInterpolator());
return animator;
}
19
Source : DefaultCardStreamAnimator.java
with Apache License 2.0
from android
with Apache License 2.0
from android
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeOutAnimator(View view, float deltaX, float deltaY) {
float endX;
float endRotationY;
float deltaXAbs = Math.abs(deltaX);
float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));
endX = deltaX < 0 ? -view.getWidth() : view.getWidth();
if (deltaX > 0)
endRotationY = -15.f;
else
endRotationY = 15.f;
// Animate position and alpha of swiped item
return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 0.f), PropertyValuesHolder.ofFloat("translationX", endX), PropertyValuesHolder.ofFloat("rotationY", endRotationY)).setDuration(duration);
}
18
Source : TriangleSkewSpinIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
PropertyValuesHolder rotation5 = PropertyValuesHolder.ofFloat("rotationX", 0, 180, 180, 0, 0);
PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationY", 0, 0, 180, 180, 0);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6, rotation5);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(2500);
animator.start();
animators.add(animator);
return animators;
}
18
Source : BallPulseRiseIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationX", 0, 360);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(1500);
animator.start();
List<Animator> animators = new ArrayList<>();
animators.add(animator);
return animators;
}
18
Source : DrawableScaleBounceAnimator.java
with MIT License
from xiandanin
with MIT License
from xiandanin
@Override
public void animate(View view) {
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("scaleX", 0f, 1f), PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)).setDuration(duration);
animator.setInterpolator(new BounceInterpolator());
animator.start();
}
18
Source : RecipesItemAnimator.java
with Apache License 2.0
from vicky7230
with Apache License 2.0
from vicky7230
private void animatePhotoLike(final RecipesAdapter.RecipeViewHolder holder) {
holder.imageViewLike.setVisibility(View.VISIBLE);
holder.imageViewLike.setScaleY(0.0f);
holder.imageViewLike.setScaleX(0.0f);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator scaleLikeIcon = ObjectAnimator.ofPropertyValuesHolder(holder.imageViewLike, PropertyValuesHolder.ofFloat("scaleX", 0.0f, 2.0f), PropertyValuesHolder.ofFloat("scaleY", 0.0f, 2.0f), PropertyValuesHolder.ofFloat("alpha", 0.0f, 1.0f, 0.0f));
scaleLikeIcon.setInterpolator(DECELERATE_INTERPOLATOR);
scaleLikeIcon.setDuration(1000);
ObjectAnimator scaleLikeBackground = ObjectAnimator.ofPropertyValuesHolder(holder.recipeImageCardView, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 0.95f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 0.95f, 1.0f));
scaleLikeBackground.setInterpolator(DECELERATE_INTERPOLATOR);
scaleLikeBackground.setDuration(600);
animatorSet.playTogether(scaleLikeIcon, scaleLikeBackground);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
resetLikeAnimationState(holder);
dispatchAnimationFinished(holder);
}
});
animatorSet.start();
}
18
Source : IndicatorDotView.java
with Apache License 2.0
from ronaldsmartin
with Apache License 2.0
from ronaldsmartin
// endregion
// region Slide animation
/**
* Animation: Slide this view to another location on the screen.
*
* @param toX The horizontal coordinate to which this view should move, in this view's
* coordinate space.
* @param toY The vertical coordinate to which this view should move, in this view's
* coordinate space.
* @return An animator that will move this view to (toX, toY) when started.
*/
@NonNull
Animator slideAnimator(final float toX, final float toY, final long animationDuration) {
final float fromX = getTranslationX();
final float fromY = getTranslationY();
final Animator animator;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
final PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, fromX, toX);
final PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, fromY, toY);
animator = ObjectAnimator.ofPropertyValuesHolder(this, translationX, translationY);
} else {
final Animator translationXAnimator = ObjectAnimator.ofFloat(this, "translationX", fromX, toX);
final Animator translationYAnimator = ObjectAnimator.ofFloat(this, "translationY", fromY, toY);
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translationXAnimator, translationYAnimator);
animator = animatorSet;
}
animator.setDuration(animationDuration);
return animator;
}
18
Source : DicesFragment.java
with MIT License
from n-apps
with MIT License
from n-apps
private void updateOnDismiss() {
int ms = LocalSettings.getDiceMaxSide();
int dc = LocalSettings.getDiceCount();
if (diceCount != dc) {
ObjectAnimator bounceAnimate = ObjectAnimator.ofPropertyValuesHolder(diceVariantInfo, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
bounceAnimate.setStartDelay(100);
bounceAnimate.start();
diceCount = dc;
viewModel.setDiceCount(diceCount);
diceVariantInfo.setText(diceCount + "d" + maxSide);
}
if (maxSide != ms) {
ObjectAnimator bounceAnimate = ObjectAnimator.ofPropertyValuesHolder(diceVariantInfo, PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.54f, 1.0f), PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.54f, 1.0f));
bounceAnimate.setStartDelay(100);
bounceAnimate.start();
maxSide = ms;
viewModel.setDiceMaxSide(maxSide);
diceVariantInfo.setText(diceCount + "d" + maxSide);
}
soundRollEnabled = LocalSettings.isSoundRollEnabled();
if (!LocalSettings.isShakeToRollEnabled()) {
viewModel.getSensorLiveData(getActivity()).removeObservers(getViewLifecycleOwner());
} else {
if (viewModel.getSensorLiveData(getActivity()) == null) {
initSensorData();
}
}
}
18
Source : SlideDistanceProvider.java
with Apache License 2.0
from material-components
with Apache License 2.0
from material-components
private static Animator createTranslationYAnimator(final View view, float startTranslation, float endTranslation, final float originalTranslation) {
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, startTranslation, endTranslation));
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setTranslationY(originalTranslation);
}
});
return animator;
}
18
Source : SlideDistanceProvider.java
with Apache License 2.0
from material-components
with Apache License 2.0
from material-components
private static Animator createTranslationXAnimator(final View view, float startTranslation, float endTranslation, final float originalTranslation) {
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.TRANSLATION_X, startTranslation, endTranslation));
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setTranslationX(originalTranslation);
}
});
return animator;
}
18
Source : PropertyListBuilder.java
with GNU General Public License v3.0
from LawnchairLauncher
with GNU General Public License v3.0
from LawnchairLauncher
public PropertyListBuilder translationX(float f) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_X, f));
return this;
}
18
Source : PropertyListBuilder.java
with GNU General Public License v3.0
from LawnchairLauncher
with GNU General Public License v3.0
from LawnchairLauncher
public PropertyListBuilder translationY(float f) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, f));
return this;
}
18
Source : AbstractSlideInView.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
@Override
public void onDragEnd(float velocity, boolean fling) {
if ((fling && velocity > 0) || mTranslationShift > 0.5f) {
mScrollInterpolator = scrollInterpolatorForVelocity(velocity);
mOpenCloseAnimator.setDuration(SwipeDetector.calculateDuration(velocity, TRANSLATION_SHIFT_CLOSED - mTranslationShift));
close(true);
} else {
mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setDuration(SwipeDetector.calculateDuration(velocity, mTranslationShift)).setInterpolator(Interpolators.DEACCEL);
mOpenCloseAnimator.start();
}
}
18
Source : AbstractSlideInView.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
protected void handleClose(boolean animate, long defaultDuration) {
if (mIsOpen && !animate) {
mOpenCloseAnimator.cancel();
setTranslationShift(TRANSLATION_SHIFT_CLOSED);
onCloseComplete();
return;
}
if (!mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
}
mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_CLOSED));
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onCloseComplete();
}
});
if (mSwipeDetector.isIdleState()) {
mOpenCloseAnimator.setDuration(defaultDuration).setInterpolator(Interpolators.ACCEL);
} else {
mOpenCloseAnimator.setInterpolator(mScrollInterpolator);
}
mOpenCloseAnimator.start();
}
18
Source : PropertyListBuilder.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
public PropertyListBuilder translationY(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, value));
return this;
}
18
Source : PropertyListBuilder.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
public PropertyListBuilder translationX(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_X, value));
return this;
}
18
Source : DragRelativeLayout.java
with Apache License 2.0
from HpWens
with Apache License 2.0
from HpWens
// 执行恢复动画 几个动画可以整合成一个 下个版本优化
private void startResumeAnim() {
if (mResumeAnimation != null && mResumeAnimation.isRunning()) {
return;
}
PropertyValuesHolder propertyScaleX = PropertyValuesHolder.ofFloat("scaleX", getScaleX(), 1.0F);
PropertyValuesHolder propertyScaleY = PropertyValuesHolder.ofFloat("scaleY", getScaleY(), 1.0F);
PropertyValuesHolder propertyTranslationX = PropertyValuesHolder.ofFloat("translationX", getTranslationX(), 0);
PropertyValuesHolder propertyTranslationY = PropertyValuesHolder.ofFloat("translationY", getTranslationY(), 0);
mResumeAnimation = ObjectAnimator.ofPropertyValuesHolder(this, propertyScaleX, propertyScaleY, propertyTranslationX, propertyTranslationY).setDuration(mDuration);
mResumeAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (mListener != null) {
mListener.onEndResume();
}
mAnimRunning = false;
}
@Override
public void onAnimationCancel(Animator animation) {
super.onAnimationCancel(animation);
mAnimRunning = false;
}
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
mAnimRunning = true;
}
});
mResumeAnimation.start();
}
See More Examples