本文整理汇总了Java中android.view.animation.TranslateAnimation.setStartOffset方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateAnimation.setStartOffset方法的具体用法?Java TranslateAnimation.setStartOffset怎么用?Java TranslateAnimation.setStartOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.TranslateAnimation
的用法示例。
在下文中一共展示了TranslateAnimation.setStartOffset方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: ApplyHorizontalScrollAnimation
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
float sign = left ? 1f : -1f;
AnimationSet animationSet = new AnimationSet(true);
animationSet.setRepeatCount(Animation.INFINITE);
animationSet.setRepeatMode(Animation.RESTART);
TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
Animation.RELATIVE_TO_PARENT, 0);
move.setStartOffset(0);
move.setDuration(speed);
move.setFillAfter(true);
animationSet.addAnimation(move);
view.startAnimation(animationSet);
}
示例9: showHelpOverlay
import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void showHelpOverlay() {
if (animationsInProgress) return;
animationsInProgress = true;
titleLayout.bringToFront();
helpLayout.setVisibility(View.VISIBLE);
Animator showAnimation;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
showAnimation = ViewAnimationUtils.createCircularReveal(helpLayout, titleBtnHelpCenterX, titleBtnHelpCenterY, 0, screenDiagonalPx);
} else {
showAnimation = ObjectAnimator.ofFloat(helpLayout, "alpha", 0f, 1f);
}
showAnimation.setInterpolator(new AccelerateInterpolator());
showAnimation.setDuration(250);
showAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mainLayout.setVisibility(View.GONE);
animationsInProgress = false;
helpLayoutShown = true;
}
});
showAnimation.start();
int textMoveOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25, getResources().getDisplayMetrics());
AnimationSet helpHeaderAnimationSet = new AnimationSet(true);
helpHeaderAnimationSet.addAnimation(new TranslateAnimation(0, 0, textMoveOffset, 0));
helpHeaderAnimationSet.addAnimation(new AlphaAnimation(0, 1f));
helpHeaderAnimationSet.setInterpolator(new DecelerateInterpolator());
helpHeaderAnimationSet.setStartOffset(200);
helpHeaderAnimationSet.setDuration(450);
helpLayoutTextHeader.startAnimation(helpHeaderAnimationSet);
AnimationSet helpContentAnimationSet = new AnimationSet(true);
helpContentAnimationSet.addAnimation(new TranslateAnimation(0, 0, textMoveOffset, 0));
helpContentAnimationSet.addAnimation(new AlphaAnimation(0, 1f));
helpContentAnimationSet.setInterpolator(new DecelerateInterpolator());
helpContentAnimationSet.setStartOffset(300);
helpContentAnimationSet.setDuration(450);
helpLayoutTextContent.startAnimation(helpContentAnimationSet);
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 65, getResources().getDisplayMetrics());
TranslateAnimation helpLayoutBottomPanelSlideUp = new TranslateAnimation(0, 0, height, 0);
helpLayoutBottomPanelSlideUp.setDuration(550);
helpLayoutBottomPanelSlideUp.setStartOffset(500);
helpLayoutBottomPanelSlideUp.setInterpolator(new DecelerateInterpolator());
helpLayoutBottomPanel.startAnimation(helpLayoutBottomPanelSlideUp);
}