本文整理匯總了Java中android.view.animation.AnticipateInterpolator類的典型用法代碼示例。如果您正苦於以下問題:Java AnticipateInterpolator類的具體用法?Java AnticipateInterpolator怎麽用?Java AnticipateInterpolator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnticipateInterpolator類屬於android.view.animation包,在下文中一共展示了AnticipateInterpolator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hide
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
public void hide() {
post(new Runnable() {
@Override
public void run() {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(ShareCard.this, "height", 0);
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
setVisibility(GONE);
if (mListener != null) {
mListener.onClick(ShareCard.this);
}
}
});
objectAnimator.setDuration(500);
objectAnimator.setInterpolator(new AnticipateInterpolator());
objectAnimator.setRepeatCount(0);
objectAnimator.start();
}
});
}
示例2: hide
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
public void hide() {
post(new Runnable() {
@Override
public void run() {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(IntroCard.this, "height", 0);
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
setVisibility(GONE);
if (mListener != null) {
mListener.onClick(IntroCard.this);
}
}
});
objectAnimator.setDuration(500);
objectAnimator.setInterpolator(new AnticipateInterpolator());
objectAnimator.setRepeatCount(0);
objectAnimator.start();
}
});
}
示例3: hideMenu
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
@SuppressWarnings("NewApi")
private void hideMenu() {
List<Animator> animList = new ArrayList<>();
for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(400);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
menuLayout.setVisibility(View.INVISIBLE);
}
});
animSet.start();
}
示例4: hideMenu
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
@SuppressWarnings("NewApi")
private void hideMenu() {
List<Animator> animList = new ArrayList<>();
for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(time);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
menuLayout.setVisibility(View.GONE);
}
});
animSet.start();
}
示例5: hideMenu
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
static void hideMenu(ViewGroup viewGroup, Point touchPoint) {
List<Animator> animList = new ArrayList<>();
for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(viewGroup.getChildAt(i), touchPoint));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(ANIM_DURATION);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
}
});
animSet.start();
}
示例6: openMenu
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
static void openMenu(ViewGroup viewGroup, int openIndex, AnimatorListenerAdapter endListener) {
List<Animator> animList = new ArrayList<>();
for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
if (openIndex == i) {
animList.add(createOpenItemAnimator(viewGroup.getChildAt(i)));
} else {
animList.add(createStayHideItemAnimator(viewGroup.getChildAt(i)));
}
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(ANIM_DURATION);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(endListener);
animSet.start();
}
示例7: startCancelMenuAnima
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
/**
* 啟動取消動畫
*/
private void startCancelMenuAnima() {
ValueAnimator cancelAnima = ValueAnimator.ofFloat(1.f, 100.f);
cancelAnima.setDuration(500);
cancelAnima.setInterpolator(new AnticipateInterpolator());
cancelAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
fraction = valueAnimator.getAnimatedFraction();
itemMenuRadius = (1 - fraction) * partSize;
itemIconSize = (int) ((1 - fraction) * iconSize);
invalidate();
}
});
cancelAnima.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
status = STATUS_MENU_CLOSED;
if (onMenuStatusChangeListener != null)
onMenuStatusChangeListener.onMenuClosed();
}
});
cancelAnima.start();
}
示例8: acceptAndClear
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
public static void acceptAndClear(final EditText editText) {
Spannable text = editText.getText();
if (TextUtils.isEmpty(text)) {
return;
}
PropertySpan propertySpan = new PropertySpan(editText);
propertySpan.setClipOffset(0, editText.getResources().getDimensionPixelOffset(R.dimen.clip_offset_bottom));
text.setSpan(propertySpan, 0, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
editText.setText(text);
ObjectAnimator moveUp = ObjectAnimator.ofFloat(propertySpan, PropertySpan.TRANSLATION_Y, 0, -editText.getHeight() / 4);
moveUp.setDuration(300);
moveUp.setInterpolator(new AnticipateInterpolator());
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(propertySpan, PropertySpan.ALPHA, 1, 0);
fadeOut.setDuration(300);
AnimatorSet set = new AnimatorSet();
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
editText.setText(null);
}
});
set.playTogether(moveUp, fadeOut);
set.start();
}
示例9: initInterpolations
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
private void initInterpolations() {
ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
add(FastOutSlowInInterpolator.class);
add(BounceInterpolator.class);
add(LinearInterpolator.class);
add(DecelerateInterpolator.class);
add(CycleInterpolator.class);
add(AnticipateInterpolator.class);
add(AccelerateDecelerateInterpolator.class);
add(AccelerateInterpolator.class);
add(AnticipateOvershootInterpolator.class);
add(FastOutLinearInInterpolator.class);
add(LinearOutSlowInInterpolator.class);
add(OvershootInterpolator.class);
}};
try {
interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: updateTransition
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
public void updateTransition(View v) {
mDrawerListenerAdapter.removeAllTransitions();
ViewTransitionBuilder builder = ViewTransitionBuilder.transit(mGradient).translationX(-mGradient.getWidth(), 0);
switch (v.getId()) {
case R.id.interpolator_default:
break;
case R.id.interpolator_linear:
builder.interpolator(new LinearInterpolator());
break;
case R.id.interpolator_accelerate:
builder.interpolator(new AccelerateInterpolator());
break;
case R.id.interpolator_decelerate:
builder.interpolator(new DecelerateInterpolator());
break;
case R.id.interpolator_fastout:
builder.interpolator(new FastOutLinearInInterpolator());
break;
case R.id.interpolator_anticipate:
builder.interpolator(new AnticipateInterpolator());
break;
}
mDrawerListenerAdapter.addTransition(builder);
}
示例11: animateSignalSlide
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
private void animateSignalSlide(final boolean reverse) {
float layoutTY = fingerPrintLayout.getTranslationY();
if (!reverse) {
fingerPrintLayout.setTranslationY(layoutTY + BreadActivity.screenParametersPoint.y);
fingerPrintLayout.animate()
.translationY(layoutTY)
.setDuration(ANIMATION_DURATION + 200)
.setInterpolator(new DecelerateOvershootInterpolator(2.0f, 1f))
.withLayer();
} else {
fingerPrintLayout.animate()
.translationY(1500)
.setDuration(ANIMATION_DURATION)
.withLayer().setInterpolator(new AnticipateInterpolator(2f)).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (getActivity() != null)
getActivity().getFragmentManager().beginTransaction().remove(FragmentFingerprint.this).commit();
}
});
}
}
示例12: prepareStyle3Animation
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
/**
* Style 3 animation will turn a 3/4 animation with Anticipate/Overshoot interpolation to a
* blank waiting - like state, wait for 2 seconds then return to the original state
*
* @return Animation
*/
private Animator prepareStyle3Animation() {
AnimatorSet animation = new AnimatorSet();
ObjectAnimator progressAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0.75f, 0f);
progressAnimation.setDuration(1200);
progressAnimation.setInterpolator(new AnticipateInterpolator());
Animator innerCircleAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0f);
innerCircleAnimation.setDuration(1200);
innerCircleAnimation.setInterpolator(new AnticipateInterpolator());
ObjectAnimator invertedProgress = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0f, 0.75f);
invertedProgress.setDuration(1200);
invertedProgress.setStartDelay(3200);
invertedProgress.setInterpolator(new OvershootInterpolator());
Animator invertedCircle = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0f, 0.75f);
invertedCircle.setDuration(1200);
invertedCircle.setStartDelay(3200);
invertedCircle.setInterpolator(new OvershootInterpolator());
animation.playTogether(progressAnimation, innerCircleAnimation, invertedProgress, invertedCircle);
return animation;
}
示例13: parse
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
public static Interpolator parse(Integer type, Float cycles) {
if (type != null) {
switch (type) {
case 0:
return new AccelerateDecelerateInterpolator();
case 1:
return new AccelerateInterpolator();
case 2:
return new AnticipateInterpolator();
case 3:
return new AnticipateOvershootInterpolator();
case 4:
return new BounceInterpolator();
case 5:
return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
case 6:
return new DecelerateInterpolator();
case 7:
return new LinearInterpolator();
case 8:
return new OvershootInterpolator();
//暫時不支持的
// case 7: return new FastOutLinearInterplator();
// case 8: return new FastOutSlowInInterplator();
// case 10: return new LinearOutSlowInInterplator();
// case 12: return new PathInterplator();
default:
return new LinearInterpolator();
}
} else {
return new LinearInterpolator();
}
}
示例14: apply
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
animator = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat("alpha", 1, 0),
PropertyValuesHolder.ofFloat("translationX", view.getLeft(), view.getRight()));
animator.setDuration(3 * PRE_DURATION);
animator.setInterpolator(new AnticipateInterpolator());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
resetView(view);
if (action != null) {
action.action();
}
}
});
return this;
}
示例15: apply
import android.view.animation.AnticipateInterpolator; //導入依賴的package包/類
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
animator = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat("alpha", 1, 0),
PropertyValuesHolder.ofFloat("scaleX", 1, 0),
PropertyValuesHolder.ofFloat("scaleY", 1, 0)
);
animator.setDuration(3 * PRE_DURATION);
animator.setInterpolator(new AnticipateInterpolator());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
resetView(view);
if (action != null) {
action.action();
}
}
});
return this;
}