use of android.view.animation.AccelerateDecelerateInterpolator in project JustAndroid by chinaltz.
the class AbAnimationUtil method playJumpAnimation.
/**
* 跳动-跳起动画.
*
* @param view the view
* @param offsetY the offset y
*/
private void playJumpAnimation(final View view, final float offsetY) {
float originalY = 0;
float finalY = -offsetY;
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(new TranslateAnimation(0, 0, originalY, finalY));
animationSet.setDuration(300);
animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.setFillAfter(true);
animationSet.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
playLandAnimation(view, offsetY);
}
});
view.startAnimation(animationSet);
}
use of android.view.animation.AccelerateDecelerateInterpolator in project JustAndroid by chinaltz.
the class AbAnimationUtil method scaleView.
/**
* 缩放View的显示.
*
* @param view 需要改变的View
* @param toSize 缩放的大小,其中正值代表放大,负值代表缩小,数值代表缩放的倍数
*/
private static void scaleView(final View view, float toSize) {
ScaleAnimation scale = null;
if (toSize == 0) {
return;
} else if (toSize > 0) {
scale = new ScaleAnimation(1.0f, toSize, 1.0f, toSize, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
} else {
scale = new ScaleAnimation(toSize * (-1), 1.0f, toSize * (-1), 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
scale.setDuration(aniDurationMillis);
scale.setInterpolator(new AccelerateDecelerateInterpolator());
scale.setFillAfter(true);
view.startAnimation(scale);
}
use of android.view.animation.AccelerateDecelerateInterpolator in project KJFrameForAndroid by kymjs.
the class KJDragGridView method animateReorder.
/**
* item的交换动画效果
*
* @param oldPosition
* @param newPosition
*/
private void animateReorder(final int oldPosition, final int newPosition) {
boolean isForward = newPosition > oldPosition;
List<Animator> resultList = new LinkedList<Animator>();
if (isForward) {
for (int pos = oldPosition; pos < newPosition; pos++) {
View view = getChildAt(pos - getFirstVisiblePosition());
if (view == null) {
continue;
}
if ((pos + 1) % mNumColumns == 0) {
resultList.add(createTranslationAnimations(view, -view.getWidth() * (mNumColumns - 1), 0, view.getHeight(), 0));
} else {
resultList.add(createTranslationAnimations(view, view.getWidth(), 0, 0, 0));
}
}
} else {
for (int pos = oldPosition; pos > newPosition; pos--) {
View view = getChildAt(pos - getFirstVisiblePosition());
if ((pos + mNumColumns) % mNumColumns == 0) {
resultList.add(createTranslationAnimations(view, view.getWidth() * (mNumColumns - 1), 0, -view.getHeight(), 0));
} else {
resultList.add(createTranslationAnimations(view, -view.getWidth(), 0, 0, 0));
}
}
}
AnimatorSet resultSet = new AnimatorSet();
resultSet.playTogether(resultList);
resultSet.setDuration(300);
resultSet.setInterpolator(new AccelerateDecelerateInterpolator());
resultSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mAnimationEnd = false;
}
@Override
public void onAnimationEnd(Animator animation) {
mAnimationEnd = true;
}
});
resultSet.start();
}
use of android.view.animation.AccelerateDecelerateInterpolator in project ImagePicker by jeasonlzy.
the class FolderPopUpWindow method exitAnimator.
private void exitAnimator() {
ObjectAnimator alpha = ObjectAnimator.ofFloat(masker, "alpha", 1, 0);
ObjectAnimator translationY = ObjectAnimator.ofFloat(listView, "translationY", 0, listView.getHeight());
AnimatorSet set = new AnimatorSet();
set.setDuration(300);
set.playTogether(alpha, translationY);
set.setInterpolator(new AccelerateDecelerateInterpolator());
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
listView.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
FolderPopUpWindow.super.dismiss();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
set.start();
}
use of android.view.animation.AccelerateDecelerateInterpolator in project ImagePicker by jeasonlzy.
the class FolderPopUpWindow method enterAnimator.
private void enterAnimator() {
ObjectAnimator alpha = ObjectAnimator.ofFloat(masker, "alpha", 0, 1);
ObjectAnimator translationY = ObjectAnimator.ofFloat(listView, "translationY", listView.getHeight(), 0);
AnimatorSet set = new AnimatorSet();
set.setDuration(400);
set.playTogether(alpha, translationY);
set.setInterpolator(new AccelerateDecelerateInterpolator());
set.start();
}
Aggregations