本文整理了Java中android.view.animation.Animation.setInterpolator()
方法的一些代码示例,展示了Animation.setInterpolator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Animation.setInterpolator()
方法的具体详情如下:
包路径:android.view.animation.Animation
类名称:Animation
方法名:setInterpolator
暂无
代码示例来源:origin: aporter/coursera-android
private Animation inFromRightAnimation() {
Animation inFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(500);
inFromRight.setInterpolator(new LinearInterpolator());
return inFromRight;
}
代码示例来源:origin: aporter/coursera-android
private Animation outToLeftAnimation() {
Animation outToLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
outToLeft.setDuration(500);
outToLeft.setInterpolator(new LinearInterpolator());
return outToLeft;
}
}
代码示例来源:origin: stackoverflow.com
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1000);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);
AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
this.setAnimation(animation);
代码示例来源:origin: stackoverflow.com
private void fadeOutAndHideImage(final ImageView img)
{
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(1000);
fadeOut.setAnimationListener(new AnimationListener()
{
public void onAnimationEnd(Animation animation)
{
img.setVisibility(View.GONE);
}
public void onAnimationRepeat(Animation animation) {}
public void onAnimationStart(Animation animation) {}
});
img.startAnimation(fadeOut);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
final View thisView = this;
thisView.clearAnimation();
if (success) {
thisView.startAnimation(new Animation() {{
super.setDuration(100);
super.setInterpolator(new AccelerateInterpolator());
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1) {
isRefreshing = false;
}
mFinishTransformation = interpolatedTime;
thisView.invalidate();
}
});
return 200;
} else {
isRefreshing = false;
return 0;
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
mIsInLoading = false;
mAniController.stop();
if (success && mEnableFadeAnimation) {
final View thisView = this;
thisView.startAnimation(new Animation() {{
super.setDuration(250);
super.setInterpolator(new AccelerateInterpolator());
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final View thisView = StoreHouseHeader.this;
mProgress = (1 - interpolatedTime);
thisView.invalidate();
if (interpolatedTime == 1) {
for (int i = 0; i < mItemList.size(); i++) {
mItemList.get(i).resetPosition(mHorizontalRandomness);
}
}
}
});
return 250;
} else {
for (int i = 0; i < mItemList.size(); i++) {
mItemList.get(i).resetPosition(mHorizontalRandomness);
}
}
return 0;
}
代码示例来源:origin: stackoverflow.com
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(500);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
outtoLeft.setDuration(500);
outtoLeft.setInterpolator(new AccelerateInterpolator());
return outtoLeft;
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromLeft.setDuration(500);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
Animation.RELATIVE_TO_PARENT, 0.0f);
outtoRight.setDuration(500);
outtoRight.setInterpolator(new AccelerateInterpolator());
return outtoRight;
代码示例来源:origin: ankidroid/Anki-Android
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new DecelerateInterpolator());
break;
case SLIDE_OUT_TO_RIGHT:
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, +1.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new AccelerateInterpolator());
break;
case SLIDE_IN_FROM_LEFT:
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new DecelerateInterpolator());
break;
case SLIDE_OUT_TO_LEFT:
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new AccelerateInterpolator());
break;
case SLIDE_IN_FROM_BOTTOM:
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new DecelerateInterpolator());
break;
case SLIDE_IN_FROM_TOP:
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new DecelerateInterpolator());
break;
代码示例来源:origin: Aspsine/SwipeToLoadLayout
private void setupAnimations() {
mAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setRotate(interpolatedTime);
}
};
mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setRepeatMode(Animation.RESTART);
mAnimation.setInterpolator(LINEAR_INTERPOLATOR);
mAnimation.setDuration(ANIMATION_DURATION);
}
代码示例来源:origin: dinuscxj/RecyclerRefreshLayout
private void initAnimation() {
mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
mRotateAnimation.setDuration(ANIMATION_DURATION);
mRotateAnimation.setFillAfter(true);
mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
mResetRotateAnimation.setDuration(ANIMATION_DURATION);
mResetRotateAnimation.setFillAfter(true);
}
代码示例来源:origin: stackoverflow.com
public void onCreate(Bundle savedInstanceState) {
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
animation.setDuration(500); // duration - half a second
animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
final Button btn = (Button) findViewById(R.id.your_btn);
btn.startAnimation(animation);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View view) {
view.clearAnimation();
}
});
}
代码示例来源:origin: rey5137/material
@Override
public void dismiss() {
if(!isShowing() || mDismissPending)
return;
if(mContentView != null){
mAnimation = new SlideAnimation(mContentView.getTop(), mContainer.getMeasuredHeight());
mAnimation.setDuration(mOutDuration);
mAnimation.setInterpolator(mOutInterpolator);
mAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mDismissPending = true;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mDismissPending = false;
mAnimation = null;
mHandler.post(mDismissAction);
}
});
mContentView.startAnimation(mAnimation);
}
else
mHandler.post(mDismissAction);
}
代码示例来源:origin: stackoverflow.com
fadeIn.setInterpolator(new DecelerateInterpolator()); // add this
fadeIn.setDuration(fadeInDuration);
fadeOut.setInterpolator(new AccelerateInterpolator()); // and this
fadeOut.setStartOffset(fadeInDuration + timeBetween);
fadeOut.setDuration(fadeOutDuration);
代码示例来源:origin: smuyyh/BookReader
private void animateOffsetToCorrectPosition(int from, AnimationListener listener) {
mFrom = from;
mAnimateToCorrectPosition.reset();
mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION);
mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator);
if (listener != null) {
mCircleView.setAnimationListener(listener);
}
mCircleView.clearAnimation();
mCircleView.startAnimation(mAnimateToCorrectPosition);
}
代码示例来源:origin: aa112901/remusic
private void animateOffsetToCorrectPosition(int from,
AnimationListener listener) {
mFrom = from;
mAnimateToCorrectPosition.reset();
mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION);
mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator);
if (listener != null) {
mHeadViewContainer.setAnimationListener(listener);
}
mHeadViewContainer.clearAnimation();
mHeadViewContainer.startAnimation(mAnimateToCorrectPosition);
}
代码示例来源:origin: rey5137/material
if (start != end) {
mAnimation = new SlideAnimation(start, end);
mAnimation.setDuration(mInDuration);
mAnimation.setInterpolator(mInInterpolator);
mAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
代码示例来源:origin: stackoverflow.com
animation.setInterpolator(easeInOutQuart);
animation.setDuration(computeDurationFromHeight(view));
view.startAnimation(animation);
a.setInterpolator(easeInOutQuart);
a.setDuration(durationMillis);
代码示例来源:origin: smuyyh/BookReader
private void animateOffsetToStartPosition(int from, AnimationListener listener) {
if (mScale) {
// Scale the item back down
startScaleDownReturnToStartAnimation(from, listener);
} else {
mFrom = from;
mAnimateToStartPosition.reset();
mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION);
mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
if (listener != null) {
mCircleView.setAnimationListener(listener);
}
mCircleView.clearAnimation();
mCircleView.startAnimation(mAnimateToStartPosition);
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
mAnimation.setDuration(ANIMATION_DURATION);
代码示例来源:origin: androidquery/androidquery
if(preset == null){
anim = new AlphaAnimation(0, 1);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration(FADE_DUR);
}else{
内容来源于网络,如有侵权,请联系作者删除!