本文整理匯總了Java中android.view.animation.AnticipateOvershootInterpolator類的典型用法代碼示例。如果您正苦於以下問題:Java AnticipateOvershootInterpolator類的具體用法?Java AnticipateOvershootInterpolator怎麽用?Java AnticipateOvershootInterpolator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnticipateOvershootInterpolator類屬於android.view.animation包,在下文中一共展示了AnticipateOvershootInterpolator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: animationThree
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
private void animationThree() {
controlByFloat.setVisibility(View.VISIBLE);
controlByNotify.setVisibility(View.VISIBLE);
triggerByFloat.setVisibility(View.VISIBLE);
confirmSetting.setVisibility(View.VISIBLE);
controlByFloat.setScaleX(0.5f);
controlByFloat.setScaleY(0.5f);
controlByNotify.setScaleX(0.5f);
controlByNotify.setScaleY(0.5f);
triggerByFloat.setScaleX(0.5f);
triggerByFloat.setScaleY(0.5f);
confirmSetting.setScaleX(0.5f);
confirmSetting.setScaleY(0.5f);
controlByFloat.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
controlByNotify.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
triggerByFloat.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
confirmSetting.animate().scaleX(1).scaleY(1).setDuration(500).setInterpolator(new AnticipateOvershootInterpolator()).start();
}
示例2: initInterpolations
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的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();
}
}
示例3: makeFirstViewReset
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
/**
* 重置第一張卡片
*/
private void makeFirstViewReset() {
CardView firstSlideView = getFirstSlideView();
firstSlideView.resetRotateType();
float rotate = firstSlideView.getCardRotation();
int startX = firstSlideView.getScrollX();
int startY = firstSlideView.getScrollY();
ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
animator.setTarget(firstSlideView);
animator.setDuration(ANIM_DURATION);
animator.setInterpolator(new AnticipateOvershootInterpolator());
animator.addUpdateListener((animation) -> {
float curRate = (float) animation.getAnimatedValue();
firstSlideView.scrollTo((int) (startX * curRate), (int) (startY * curRate));
firstSlideView.setReleaseRotation(curRate * rotate);
});
animator.start();
}
示例4: makeUnderViewReplace
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
/**
* 第一張卡片滑出時,剩餘卡片上浮
* @param position
*/
private void makeUnderViewReplace(int position) {
CardView underSlideView = slideViewMap.get(position);
if (underSlideView != null) {
ValueAnimator animator = ValueAnimator.ofFloat(percent, 1);
animator.setTarget(underSlideView);
animator.setDuration(ANIM_DURATION);
animator.setInterpolator(new AnticipateOvershootInterpolator());
animator.addUpdateListener(animation -> {
float curPercent = (float) animation.getAnimatedValue();
makeUnderViewInvalidate(position, curPercent);
});
animator.start();
}
}
示例5: hideInitialCallToAction
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
private void hideInitialCallToAction() {
animatorFor(generateData, getAnimatorContext())
.withInterpolator(new AnticipateOvershootInterpolator())
.alpha(0f)
.scale(0f)
.addOnAnimationCompleted(new OnAnimationCompleted() {
@Override
public void onAnimationCompleted(boolean finished) {
if (finished) {
generateData.setVisibility(View.INVISIBLE);
generateData.setScaleX(1f);
generateData.setScaleY(1f);
generateData.setAlpha(1f);
}
}
})
.start();
}
示例6: showGenerateData
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
private void showGenerateData() {
animatorFor(generateData, getAnimatorContext())
.withInterpolator(new AnticipateOvershootInterpolator())
.addOnAnimationWillStart(new MultiAnimator.WillRunListener() {
@Override
public void onMultiAnimatorWillRun(@NonNull MultiAnimator animator) {
generateData.setAlpha(0f);
generateData.setScaleX(0f);
generateData.setScaleY(0f);
generateData.setVisibility(View.VISIBLE);
}
})
.alpha(1f)
.scale(1f)
.start();
}
示例7: fillResourceAttributes
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
public void fillResourceAttributes(AnticipateOvershootInterpolator interpolator, DOMElement domElement, AttrInterpolatorContext attrCtx)
{
XMLInflaterResource xmlInflaterInterpolator = attrCtx.getXMLInflaterResource();
XMLInflaterRegistry xmlInflaterRegistry = xmlInflaterInterpolator.getInflatedXMLResource().getXMLInflaterRegistry();
DOMAttr attrTension = domElement.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "tension");
float tension = attrTension != null ? xmlInflaterRegistry.getFloat(attrTension.getResourceDesc(),attrCtx.getXMLInflaterContext()) : 2.0f;
DOMAttr attrExtraTension = domElement.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "extraTension");
float extraTension = attrExtraTension != null ? xmlInflaterRegistry.getFloat(attrExtraTension.getResourceDesc(),attrCtx.getXMLInflaterContext()) : 1.5f;
float totalTension = tension * extraTension;
fieldMTension.set(interpolator,totalTension);
super.fillResourceAttributes(interpolator,domElement,attrCtx);
}
示例8: onCreate
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_animation);
ImageView view = new ImageView(this);
view.setBackgroundResource(R.drawable.custom_button_selector);
view.setScaleType(ImageView.ScaleType.CENTER);
mReachability = new Reachability(this);
mReachability.canTouchableBackView(true);
mReachability.setBackImageResource(R.drawable.tiles);
// Should call before makeHoverView!
mReachability.setHoverView(view, android.R.drawable.ic_partial_secure, android.R.drawable.ic_secure);
mReachability.makeHoverView(Reachability.Position.CENTER);
mReachability.setCustomSlideInAnimation(1000, new AnticipateOvershootInterpolator(), fromLeftAnimation());
mReachability.setCustomSlideOutAnimation(1000, new AnticipateOvershootInterpolator(), toRightAnimation());
findViewById(R.id.switch_hover).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mReachability.switchHover();
}
});
}
示例9: rockBounce
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
public static void rockBounce(final View theView) {
theView.animate()
.rotationXBy(30.0f)
.setDuration(200)
.setInterpolator(new AnticipateOvershootInterpolator())
.withEndAction(new Runnable() {
@Override
public void run() {
theView.animate()
.setDuration(100)
.rotationX(0)
.setInterpolator(new AnticipateOvershootInterpolator())
.start();
}
});
}
示例10: animateRemoveImpl
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
final View view = holder.itemView;
ViewCompat.animate(view).cancel();
return ViewCompat.animate(view)
.translationX(Utils.getScreenDimensions(holder.itemView.getContext()).x)
.setInterpolator(new AnticipateOvershootInterpolator());
}
示例11: hide
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
public void hide(float x) {
this.lastPositionX = x;
float offset = getOffset(x);
int widthAdjustment = getWidthAdjustment();
AnimationSet animation = new AnimationSet(false);
Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
Animation.ABSOLUTE, widthAdjustment,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f);
scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
translateAnimation.setInterpolator(new DecelerateInterpolator());
animation.addAnimation(scaleAnimation);
animation.addAnimation(translateAnimation);
animation.setDuration(ANIMATION_DURATION);
animation.setFillBefore(true);
animation.setFillAfter(false);
animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
recordButtonFab.setVisibility(View.GONE);
recordButtonFab.clearAnimation();
recordButtonFab.startAnimation(animation);
}
示例12: parse
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的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();
}
}
示例13: createInterpolator
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
/**
* Creates interpolator.
*
* @param interpolatorType
* @return
*/
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
switch (interpolatorType) {
case ACCELERATE_DECELERATE_INTERPOLATOR:
return new AccelerateDecelerateInterpolator();
case ACCELERATE_INTERPOLATOR:
return new AccelerateInterpolator();
case ANTICIPATE_INTERPOLATOR:
return new AnticipateInterpolator();
case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
return new AnticipateOvershootInterpolator();
case BOUNCE_INTERPOLATOR:
return new BounceInterpolator();
case DECELERATE_INTERPOLATOR:
return new DecelerateInterpolator();
case FAST_OUT_LINEAR_IN_INTERPOLATOR:
return new FastOutLinearInInterpolator();
case FAST_OUT_SLOW_IN_INTERPOLATOR:
return new FastOutSlowInInterpolator();
case LINEAR_INTERPOLATOR:
return new LinearInterpolator();
case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
return new LinearOutSlowInInterpolator();
case OVERSHOOT_INTERPOLATOR:
return new OvershootInterpolator();
default:
return new LinearInterpolator();
}
}
示例14: setEffect
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
private static void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
switch (interpolatorType) {
case 0:
animation.setInterpolator(new LinearInterpolator());
break;
case 1:
animation.setInterpolator(new AccelerateInterpolator());
break;
case 2:
animation.setInterpolator(new DecelerateInterpolator());
break;
case 3:
animation.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case 4:
animation.setInterpolator(new BounceInterpolator());
break;
case 5:
animation.setInterpolator(new OvershootInterpolator());
break;
case 6:
animation.setInterpolator(new AnticipateInterpolator());
break;
case 7:
animation.setInterpolator(new AnticipateOvershootInterpolator());
break;
default:
break;
}
animation.setDuration(durationMillis);
animation.setStartOffset(delayMillis);
}
示例15: onTabChanged
import android.view.animation.AnticipateOvershootInterpolator; //導入依賴的package包/類
/**
* NavHelper處理後,回調的方法
* @param newTab 新的Tab
* @param oldTab 舊的Tab
*/
@Override
public void onTabChanged(NavHelper.Tab<Integer> newTab, NavHelper.Tab<Integer> oldTab) {
// 從額外字段中取出我們的Title資源Id
title.setText(newTab.extra);
// 對FloatButton進行隱藏和顯示動畫
float transY = 0;
float rotation = 0;
// 判斷所處界麵
if (Objects.equals(newTab.extra, R.string.title_home)) {
transY = Ui.dipToPx(getResources(), 76);
} else {
// 此時Y默認為0===顯示fb
if (Objects.equals(newTab.extra, R.string.title_group)) {
floatbutton.setImageResource(R.drawable.ic_group_add);
rotation = -360;
} else {
// 聯係人
floatbutton.setImageResource(R.drawable.ic_contact_add);
rotation = 360;
}
}
// 開始動畫,旋轉,Y軸惟一,彈性
floatbutton.animate()
.rotation(rotation)
.setInterpolator(new AnticipateOvershootInterpolator(1))
.translationY(transY)
.setDuration(480)
.start();
}