use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by ResurrectionRemix.
the class GlowBackground method getAnimator.
private Animator getAnimator(boolean hide) {
float start = mCircleSize;
float end = MAX_CIRCLE_SIZE;
if (hide) {
end = 0f;
}
ValueAnimator animator = ObjectAnimator.ofFloat(start, end);
animator.setInterpolator(new AnticipateOvershootInterpolator());
animator.setDuration(300);
animator.addUpdateListener(this);
return animator;
}
use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by ResurrectionRemix.
the class DessertCaseView method place.
public synchronized void place(View v, Point pt, boolean animate) {
final int i = pt.x;
final int j = pt.y;
final float rnd = frand();
if (v.getTag(TAG_POS) != null) {
for (final Point oc : getOccupied(v)) {
mFreeList.add(oc);
mCells[oc.y * mColumns + oc.x] = null;
}
}
int scale = 1;
if (rnd < PROB_4X) {
if (!(i >= mColumns - 3 || j >= mRows - 3)) {
scale = 4;
}
} else if (rnd < PROB_3X) {
if (!(i >= mColumns - 2 || j >= mRows - 2)) {
scale = 3;
}
} else if (rnd < PROB_2X) {
if (!(i == mColumns - 1 || j == mRows - 1)) {
scale = 2;
}
}
v.setTag(TAG_POS, pt);
v.setTag(TAG_SPAN, scale);
tmpSet.clear();
final Point[] occupied = getOccupied(v);
for (final Point oc : occupied) {
final View squatter = mCells[oc.y * mColumns + oc.x];
if (squatter != null) {
tmpSet.add(squatter);
}
}
for (final View squatter : tmpSet) {
for (final Point sq : getOccupied(squatter)) {
mFreeList.add(sq);
mCells[sq.y * mColumns + sq.x] = null;
}
if (squatter != v) {
squatter.setTag(TAG_POS, null);
if (animate) {
squatter.animate().withLayer().scaleX(0.5f).scaleY(0.5f).alpha(0).setDuration(DURATION).setInterpolator(new AccelerateInterpolator()).setListener(new Animator.AnimatorListener() {
public void onAnimationStart(Animator animator) {
}
public void onAnimationEnd(Animator animator) {
removeView(squatter);
}
public void onAnimationCancel(Animator animator) {
}
public void onAnimationRepeat(Animator animator) {
}
}).start();
} else {
removeView(squatter);
}
}
}
for (final Point oc : occupied) {
mCells[oc.y * mColumns + oc.x] = v;
mFreeList.remove(oc);
}
final float rot = (float) irand(0, 4) * 90f;
if (animate) {
v.bringToFront();
AnimatorSet set1 = new AnimatorSet();
set1.playTogether(ObjectAnimator.ofFloat(v, View.SCALE_X, (float) scale), ObjectAnimator.ofFloat(v, View.SCALE_Y, (float) scale));
set1.setInterpolator(new AnticipateOvershootInterpolator());
set1.setDuration(DURATION);
AnimatorSet set2 = new AnimatorSet();
set2.playTogether(ObjectAnimator.ofFloat(v, View.ROTATION, rot), ObjectAnimator.ofFloat(v, View.X, i * mCellSize + (scale - 1) * mCellSize / 2), ObjectAnimator.ofFloat(v, View.Y, j * mCellSize + (scale - 1) * mCellSize / 2));
set2.setInterpolator(new DecelerateInterpolator());
set2.setDuration(DURATION);
set1.addListener(makeHardwareLayerListener(v));
set1.start();
set2.start();
} else {
v.setX(i * mCellSize + (scale - 1) * mCellSize / 2);
v.setY(j * mCellSize + (scale - 1) * mCellSize / 2);
v.setScaleX((float) scale);
v.setScaleY((float) scale);
v.setRotation(rot);
}
}
use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by DirtyUnicorns.
the class DessertCaseView method place.
public synchronized void place(View v, Point pt, boolean animate) {
final int i = pt.x;
final int j = pt.y;
final float rnd = frand();
if (v.getTag(TAG_POS) != null) {
for (final Point oc : getOccupied(v)) {
mFreeList.add(oc);
mCells[oc.y * mColumns + oc.x] = null;
}
}
int scale = 1;
if (rnd < PROB_4X) {
if (!(i >= mColumns - 3 || j >= mRows - 3)) {
scale = 4;
}
} else if (rnd < PROB_3X) {
if (!(i >= mColumns - 2 || j >= mRows - 2)) {
scale = 3;
}
} else if (rnd < PROB_2X) {
if (!(i == mColumns - 1 || j == mRows - 1)) {
scale = 2;
}
}
v.setTag(TAG_POS, pt);
v.setTag(TAG_SPAN, scale);
tmpSet.clear();
final Point[] occupied = getOccupied(v);
for (final Point oc : occupied) {
final View squatter = mCells[oc.y * mColumns + oc.x];
if (squatter != null) {
tmpSet.add(squatter);
}
}
for (final View squatter : tmpSet) {
for (final Point sq : getOccupied(squatter)) {
mFreeList.add(sq);
mCells[sq.y * mColumns + sq.x] = null;
}
if (squatter != v) {
squatter.setTag(TAG_POS, null);
if (animate) {
squatter.animate().withLayer().scaleX(0.5f).scaleY(0.5f).alpha(0).setDuration(DURATION).setInterpolator(new AccelerateInterpolator()).setListener(new Animator.AnimatorListener() {
public void onAnimationStart(Animator animator) {
}
public void onAnimationEnd(Animator animator) {
removeView(squatter);
}
public void onAnimationCancel(Animator animator) {
}
public void onAnimationRepeat(Animator animator) {
}
}).start();
} else {
removeView(squatter);
}
}
}
for (final Point oc : occupied) {
mCells[oc.y * mColumns + oc.x] = v;
mFreeList.remove(oc);
}
final float rot = (float) irand(0, 4) * 90f;
if (animate) {
v.bringToFront();
AnimatorSet set1 = new AnimatorSet();
set1.playTogether(ObjectAnimator.ofFloat(v, View.SCALE_X, (float) scale), ObjectAnimator.ofFloat(v, View.SCALE_Y, (float) scale));
set1.setInterpolator(new AnticipateOvershootInterpolator());
set1.setDuration(DURATION);
AnimatorSet set2 = new AnimatorSet();
set2.playTogether(ObjectAnimator.ofFloat(v, View.ROTATION, rot), ObjectAnimator.ofFloat(v, View.X, i * mCellSize + (scale - 1) * mCellSize / 2), ObjectAnimator.ofFloat(v, View.Y, j * mCellSize + (scale - 1) * mCellSize / 2));
set2.setInterpolator(new DecelerateInterpolator());
set2.setDuration(DURATION);
set1.addListener(makeHardwareLayerListener(v));
set1.start();
set2.start();
} else {
v.setX(i * mCellSize + (scale - 1) * mCellSize / 2);
v.setY(j * mCellSize + (scale - 1) * mCellSize / 2);
v.setScaleX((float) scale);
v.setScaleY((float) scale);
v.setRotation(rot);
}
}
use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by crdroidandroid.
the class GlowBackground method getAnimator.
private Animator getAnimator(boolean hide) {
float start = mCircleSize;
float end = MAX_CIRCLE_SIZE;
if (hide) {
end = 0f;
}
ValueAnimator animator = ObjectAnimator.ofFloat(start, end);
animator.setInterpolator(new AnticipateOvershootInterpolator());
animator.setDuration(300);
animator.addUpdateListener(this);
return animator;
}
use of android.view.animation.AnticipateOvershootInterpolator in project weiui by kuaifan.
the class RxAnimationTool method popout.
public static ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter) {
ObjectAnimator popout = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1f, 0f), PropertyValuesHolder.ofFloat("scaleX", 1f, 0f), PropertyValuesHolder.ofFloat("scaleY", 1f, 0f));
popout.setDuration(duration);
popout.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
view.setVisibility(View.GONE);
if (animatorListenerAdapter != null) {
animatorListenerAdapter.onAnimationEnd(animation);
}
}
});
popout.setInterpolator(new AnticipateOvershootInterpolator());
return popout;
}
Aggregations