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;
}
WelcomeSnowActy.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:QMark
作者:
评论列表
文章目录