本文整理汇总了Java中android.view.animation.TranslateAnimation.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateAnimation.setInterpolator方法的具体用法?Java TranslateAnimation.setInterpolator怎么用?Java TranslateAnimation.setInterpolator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.TranslateAnimation
的用法示例。
在下文中一共展示了TranslateAnimation.setInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishInflate
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
protected void onFinishInflate() {
super.onFinishInflate();
if (!isInEditMode()) {
TranslateAnimation translateAnimation = new TranslateAnimation(1, 2.0f, 1, 0.0f, 0, 0.0f, 0, 0.0f);
translateAnimation.setDuration(1500);
translateAnimation.setStartOffset(2500);
translateAnimation.setInterpolator(new BounceInterpolator());
animate().setStartDelay(5500).alpha(0.0f).setDuration(400).withEndAction(new Runnable() {
public void run() {
((ViewGroup) SplashScreenView.this.getParent()).removeView(SplashScreenView.this);
}
});
}
}
示例2: getEndAnimation
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 获得离场动画
*
* @return
*/
protected Animation getEndAnimation() {
AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
animAlpha.setDuration(TIME_END_ANIM);
animAlpha.setFillAfter(true);
TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, -1.5f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f);
animTrans.setDuration(TIME_END_ANIM);
animTrans.setFillAfter(true);
animTrans.setInterpolator(new AccelerateInterpolator());
AnimationSet sets = new AnimationSet(true);
sets.addAnimation(animAlpha);
sets.addAnimation(animTrans);
return sets;
}
示例3: animatefigure
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private boolean animatefigure(final Tuple<Integer, Integer> from, final Tuple<Integer, Integer> to, int speed) {
if (figuren[from.first][from.last] != null) {
Point rectFrom = chessboardView.getRectangleCoordinates(from);
Point rectTo = chessboardView.getRectangleCoordinates(to);
int deltaX = rectTo.x - rectFrom.x;
int deltaY = rectTo.y - rectFrom.y;
TranslateAnimation translateAnimation = new TranslateAnimation(0, deltaX, 0, deltaY);
translateAnimation.setDuration(speed);
translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
translateAnimation.setAnimationListener(new AnimationEndListener() {
@Override
public void onAnimationEnd(Animation animation) {
update();
if (aiGame && !board.isWhitesTurn()) {
aimove();
} else {
stateAllowClick = true;
}
}
});
figuren[from.first][from.last].startAnimation(translateAnimation);
return true;
}
return false;
}
示例4: onPostExecute
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if (itemList.size() == 0) Toast.makeText(MyRank.this, "发生未知错误",Toast.LENGTH_SHORT).show();
RecyclerView rankList = findViewById(R.id.rank_list);
ReleaseRankItemAdapter adapter = new ReleaseRankItemAdapter(itemList);
GridLayoutManager layoutManager = new GridLayoutManager(MyRank.this, 1);
rankList.setLayoutManager(layoutManager);
rankList.setAdapter(adapter);
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF,
0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0);
animation.setInterpolator(new DecelerateInterpolator());
animation.setDuration(550);
lac = new LayoutAnimationController(animation, 0.12f);
lac.setInterpolator(new DecelerateInterpolator());
rankList.setLayoutAnimation(lac);
RecyclerView ranklist1 = findViewById(R.id.rank_list1);
ReleaseRankItemAdapter adapter1 = new ReleaseRankItemAdapter(itemListOthers);
GridLayoutManager layoutManager1 = new GridLayoutManager(MyRank.this,1);
ranklist1.setLayoutManager(layoutManager1);
ranklist1.setAdapter(adapter1);
ranklist1.setLayoutAnimation(lac);
}
示例5: initShowAnimation
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
protected Animation initShowAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, -DimensUtils.dipToPx(getContext(), 350f), 0);
translateAnimation.setDuration(450);
translateAnimation.setInterpolator(new OvershootInterpolator(1));
return translateAnimation;
}
示例6: initExitAnimation
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
protected Animation initExitAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, 0, -DimensUtils.dipToPx(getContext(), 350f));
translateAnimation.setDuration(450);
translateAnimation.setInterpolator(new OvershootInterpolator(-4));
return translateAnimation;
}
示例7: translateYYAnimation
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 上下移动的循环动画
*/
public static Animation translateYYAnimation(float toYValue) {
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, toYValue);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
animation.setDuration(300);
return animation;
}
示例8: randomTranslate
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private TranslateAnimation randomTranslate(int startTopInParent, int duration, AnimationListener l) {
float halfPercent = (1 + startTopInParent * 1.0f / mScreenHeight) / 2;
TranslateAnimation trans = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, (float) ((Math.random() > 0.5f ? 1 : -1) * Math.random()) * 5,
Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, (float) (Math.random() * halfPercent + halfPercent));
trans.setInterpolator(this, android.R.anim.linear_interpolator);
trans.setStartOffset(0);
trans.setDuration(duration);
trans.setAnimationListener(l);
return trans;
}
示例9: randomTranslateX
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private TranslateAnimation randomTranslateX() {
TranslateAnimation trans = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, (float) ((Math.random() > 0.5f ? 1 : -1) * Math.random()),
Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);
trans.setInterpolator(this, android.R.anim.accelerate_decelerate_interpolator);
trans.setRepeatCount(Animation.INFINITE);
trans.setRepeatMode(Animation.REVERSE);
trans.setStartOffset(0);
trans.setDuration((int) (Math.random() * 2000 + 1000));
return trans;
}
示例10: trans
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void trans(long dura, float frX, float toX) {
TranslateAnimation animation = new TranslateAnimation(frX, toX, 0.0F, 0.0F);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(dura);
animation.setFillAfter(true);
vTrans.startAnimation(animation);
}
示例11: reset
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void reset() {
tracking = false;
TranslateAnimation a =
new TranslateAnimation(slide.getLeft(), getLeft(), 0, 0);
a.setDuration(SLIP_MS);
a.setInterpolator(new DecelerateInterpolator(SLIP_ACCEL));
slide.startAnimation(a);
slide.offsetLeftAndRight(getLeft() - slide.getLeft());
}
示例12: getAnimationSetFromLeft
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 从左侧进入,并带有弹性的动画
*
* @return
*/
public static AnimationSet getAnimationSetFromLeft() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, -1.0f, RELATIVE_TO_SELF, 0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX1.setDuration(300);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, -0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX2.setStartOffset(300);
translateX2.setInterpolator(new DecelerateInterpolator());
translateX2.setDuration(50);
TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX3.setStartOffset(350);
translateX3.setInterpolator(new DecelerateInterpolator());
translateX3.setDuration(50);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
alphaAnimation.setDuration(400);
alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.addAnimation(translateX1);
animationSet.addAnimation(translateX2);
animationSet.addAnimation(translateX3);
//animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(400);
return animationSet;
}
示例13: getAnimationSetFromRight
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 从右侧进入,并带有弹性的动画
*
* @return
*/
public static AnimationSet getAnimationSetFromRight() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, 1.0f, RELATIVE_TO_SELF, -0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX1.setDuration(300);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX2.setStartOffset(300);
translateX2.setInterpolator(new DecelerateInterpolator());
translateX2.setDuration(50);
TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, 0f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX3.setStartOffset(350);
translateX3.setInterpolator(new DecelerateInterpolator());
translateX3.setDuration(50);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
alphaAnimation.setDuration(400);
alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.addAnimation(translateX1);
animationSet.addAnimation(translateX2);
animationSet.addAnimation(translateX3);
animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(400);
return animationSet;
}
示例14: getAnimationSetFromBottom
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 从底部进入
*
* @return
*/
public static AnimationSet getAnimationSetFromBottom() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0,
RELATIVE_TO_SELF, 2.5f, RELATIVE_TO_SELF, 0);
translateX1.setDuration(400);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
animationSet.addAnimation(translateX1);
animationSet.setDuration(400);
return animationSet;
}
示例15: getAnimationSetFromTop
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
* 从顶部进入
*
* @return
*/
public static AnimationSet getAnimationSetFromTop() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0,
RELATIVE_TO_SELF, -2.5f, RELATIVE_TO_SELF, 0);
translateX1.setDuration(400);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
animationSet.addAnimation(translateX1);
animationSet.setDuration(400);
return animationSet;
}