public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
final int ANIMATION_DURATION = 650;
final int BASE_DELAY = 50;
TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);
AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
final AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(translationAnimation);
animationSet.addAnimation(alphaAnimation);
animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.setFillAfter(true);
animationSet.setFillBefore(true);
animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);
aCard.setAnimation(animationSet);
}
java类android.view.animation.AlphaAnimation的实例源码
AnimationService.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 40
收藏 0
点赞 0
评论 0
Circle8YMenu.java 文件源码
项目:YMenuView
阅读 32
收藏 0
点赞 0
评论 0
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
//为不同的Option设置延时
if (index % 2 == 1) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
ViewHolder.java 文件源码
项目:GitHub
阅读 28
收藏 0
点赞 0
评论 0
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
getView(viewId).setAlpha(value);
} else
{
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
ViewHolder.java 文件源码
项目:GitHub
阅读 35
收藏 0
点赞 0
评论 0
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
getView(viewId).setAlpha(value);
} else
{
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
TreeYMenu.java 文件源码
项目:YMenuView
阅读 29
收藏 0
点赞 0
评论 0
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//设置动画延时
animationSet.setStartOffset(60*(getOptionPositionCount() - index));
return animationSet;
}
BottomRedPointView.java 文件源码
项目:letv
阅读 39
收藏 0
点赞 0
评论 0
private void init(Context context, View target) {
this.context = context;
this.target = target;
fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
this.isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
UIIDialogImpl.java 文件源码
项目:RLibrary
阅读 33
收藏 0
点赞 0
评论 0
/**
* 对话框结束时的动画
*/
@Override
public Animation loadFinishAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
setDefaultConfig(translateAnimation, true);
setDefaultConfig(alphaAnimation, true);
translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
BottomMenu.java 文件源码
项目:BottomMenu
阅读 42
收藏 0
点赞 0
评论 0
private Animation scaleSmallAnim(int duration, final View child) {
AnimationSet animationSet = new AnimationSet(true);
ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
AlphaAnimation alphaAnim = new AlphaAnimation(1f, 0.0f);
alphaAnim.setFillAfter(true);
animationSet.addAnimation(scaleAnim);
animationSet.addAnimation(alphaAnim);
animationSet.setDuration(duration);
return animationSet;
}
DrawerToast.java 文件源码
项目:AndroidBasicLibs
阅读 30
收藏 0
点赞 0
评论 0
/**
* 获得离场动画
*
* @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;
}
QMUIBottomSheet.java 文件源码
项目:QMUI_Android
阅读 38
收藏 0
点赞 0
评论 0
/**
* BottomSheet升起动画
*/
private void animateUp() {
if (mContentView == null) {
return;
}
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet set = new AnimationSet(true);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setInterpolator(new DecelerateInterpolator());
set.setDuration(mAnimationDuration);
set.setFillAfter(true);
mContentView.startAnimation(set);
}
CoreTeamEventActivity.java 文件源码
项目:Nimbus
阅读 29
收藏 0
点赞 0
评论 0
public static void startAlphaAnimation(View v, long duration, int visibility) {
AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
? new AlphaAnimation(0f, 1f)
: new AlphaAnimation(1f, 0f);
alphaAnimation.setDuration(duration);
alphaAnimation.setFillAfter(true);
v.startAnimation(alphaAnimation);
}
ListViewItemAnimations.java 文件源码
项目:buildAPKsSamples
阅读 34
收藏 0
点赞 0
评论 0
/**
* Sets the horizontal position and translucency of the view being swiped.
*/
@SuppressLint("NewApi")
private void setSwipePosition(View view, float deltaX) {
float fraction = Math.abs(deltaX) / view.getWidth();
if (isRuntimePostGingerbread()) {
view.setTranslationX(deltaX);
view.setAlpha(1 - fraction);
} else {
// Hello, Gingerbread!
TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
mCurrentX = deltaX;
mCurrentAlpha = (1 - fraction);
AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
AnimationSet set = new AnimationSet(true);
set.addAnimation(swipeAnim);
set.addAnimation(alphaAnim);
set.setFillAfter(true);
set.setFillEnabled(true);
view.startAnimation(set);
}
}
ItemViewHolder.java 文件源码
项目:RealmTasks
阅读 37
收藏 0
点赞 0
评论 0
void setHintPanelVisible(boolean visible)
{
final int visibility = hintPanel.getVisibility();
boolean previousVisible = visibility == View.VISIBLE;
if (previousVisible == visible)
{
return;
}
if (visible)
{
hintPanel.setVisibility(View.VISIBLE);
final AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
alphaAnimation.setDuration(150);
hintPanel.setAnimation(alphaAnimation);
final RotateAnimation rotateAnimation = new RotateAnimation(
-90, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(500);
arrow.startAnimation(rotateAnimation);
}
else
{
hintPanel.setVisibility(View.GONE);
}
}
ItemsCountView.java 文件源码
项目:showroom-android
阅读 34
收藏 0
点赞 0
评论 0
private Animation createPositionAnimation(int fromY, int toY, float fromAlpha, float toAlpha, int duration) {
TranslateAnimation translate = new TranslateAnimation(0, 0, fromY, toY);
translate.setDuration(duration);
AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
alpha.setDuration(duration);
AnimationSet set = new AnimationSet(true);
set.setInterpolator(new DecelerateInterpolator());
set.addAnimation(translate);
set.addAnimation(alpha);
return set;
}
BaseAdapterHelper.java 文件源码
项目:GitHub
阅读 40
收藏 0
点赞 0
评论 0
/**
* Add an action to set the alpha of a view. Can be called multiple times.
* Alpha between 0-1.
* 设置控件的显示的透明度
*/
public BaseAdapterHelper setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
retrieveView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
retrieveView(viewId).startAnimation(alpha);
}
return this;
}
UIIDialogImpl.java 文件源码
项目:RLibrary
阅读 34
收藏 0
点赞 0
评论 0
/**
* 对话框启动时的动画
*/
@Override
public Animation loadStartAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
setDefaultConfig(translateAnimation, false);
setDefaultConfig(alphaAnimation, false);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
SimpleActivity.java 文件源码
项目:GitHub
阅读 37
收藏 0
点赞 0
评论 0
@Override public void apply(@NonNull View view, int index) {
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
alphaAnimation.setFillBefore(true);
alphaAnimation.setDuration(500);
alphaAnimation.setStartOffset(index * 100);
view.startAnimation(alphaAnimation);
}
FlashActivity.java 文件源码
项目:GitHub
阅读 42
收藏 0
点赞 0
评论 0
@Bus(EventTags.FLASH_INIT_UI)
public void initUI() {
AlphaAnimation anim = new AlphaAnimation(0.8f, 0.1f);
anim.setDuration(5000);
mViewBinding.view.startAnimation(anim);
AnimationUtil.setAnimationListener(anim, () -> OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN));
}
BaseViewHolder.java 文件源码
项目:GitHub
阅读 35
收藏 0
点赞 0
评论 0
/**
* Add an action to set the alpha of a view. Can be called multiple times.
* Alpha between 0-1.
*/
public BaseViewHolder setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
EasyRVHolder.java 文件源码
项目:GitHub
阅读 38
收藏 0
点赞 0
评论 0
@Override
public EasyRVHolder setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
SplashActivity.java 文件源码
项目:JueDiQiuSheng
阅读 41
收藏 0
点赞 0
评论 0
private void btnAlpha(View view,long duration) {
//透明度动画 public AlphaAnimation(float fromAlpha, float toAlpha){}
AlphaAnimation aa = new AlphaAnimation(0, 1);
//持续时间
aa.setDuration(duration);
view.startAnimation(aa);
}
MainActivity.java 文件源码
项目:SDCardCleaner
阅读 36
收藏 0
点赞 0
评论 0
private AnimationSet createQuitAnimation(View _view, long _offSet) {
AnimationSet _set = new AnimationSet(true);
_set.addAnimation(new AlphaAnimation(1, 0));
_set.addAnimation(new ScaleAnimation(1, 2, 1, 2));
_set.addAnimation(new TranslateAnimation(0, -_view.getWidth() / 2, 0, -_view.getHeight() / 2));
_set.setDuration(150);
_set.setStartOffset(_offSet);
_set.setFillAfter(true);
return _set;
}
BaseViewHolder.java 文件源码
项目:GitHub
阅读 34
收藏 0
点赞 0
评论 0
/**
* Add an action to set the alpha of a view. Can be called multiple times.
* Alpha between 0-1.
*/
public BaseViewHolder setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
WelcomeUtil.java 文件源码
项目:WelcomeView
阅读 53
收藏 0
点赞 0
评论 0
public static void open(final Activity activity, String imageUrl, final OnWelcomeDone onWelcomeDone) {
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
final View welcome = LayoutInflater.from(activity).inflate(R.layout.welcome, null);
final AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
alphaAnimation.setDuration(1000);
welcome.startAnimation(alphaAnimation);
Glide.with(activity).load(imageUrl).into(((ImageView) welcome.findViewById(R.id.iv_welcome)));
activity.setContentView(welcome);
final TextView skipView = (TextView) welcome.findViewById(R.id.tv_skip);
final CountDownTimer start = new CountDownTimer(5000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
skipView.setText("跳过" + ((millisUntilFinished / 1000) - 1));
}
@Override
public void onFinish() {
AlphaAnimation alphaAnimation1 = new AlphaAnimation(1.0f, 0.0f);
alphaAnimation1.setDuration(1000);
welcome.startAnimation(alphaAnimation1);
if (onWelcomeDone != null) {
onWelcomeDone.onDone();
}
}
}.start();
skipView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
start.onFinish();
}
});
}
FragmentManagerImpl.java 文件源码
项目:letv
阅读 31
收藏 0
点赞 0
评论 0
static boolean modifiesAlpha(Animation anim) {
if (anim instanceof AlphaAnimation) {
return true;
}
if (anim instanceof AnimationSet) {
List<Animation> anims = ((AnimationSet) anim).getAnimations();
for (int i = 0; i < anims.size(); i++) {
if (anims.get(i) instanceof AlphaAnimation) {
return true;
}
}
}
return false;
}
BaseViewHolder.java 文件源码
项目:GitHub
阅读 40
收藏 0
点赞 0
评论 0
/**
* Add an action to set the alpha of a view. Can be called multiple times.
* Alpha between 0-1.
*/
public BaseViewHolder setAlpha(@IdRes int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
ViewHolderHelper.java 文件源码
项目:MVPtemplate
阅读 29
收藏 0
点赞 0
评论 0
@SuppressLint("NewApi")
public ViewHolderHelper setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
AnimationService.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 32
收藏 0
点赞 0
评论 0
/**
* For the Card Views
*/
public static AnimationSet startAlphaRevealAnimation(int delay, final View VIEW, boolean includeTransition) {
final int ANIMATION_DURATION = 300;
final Animation mAlphaAnimation = new AlphaAnimation(0f, 1f);
mAlphaAnimation.setDuration(ANIMATION_DURATION);
mAlphaAnimation.setFillAfter(true);
final AnimationSet mRevealAnimations = new AnimationSet(true);
mRevealAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
mRevealAnimations.addAnimation(mAlphaAnimation);
mRevealAnimations.setFillAfter(true);
if (includeTransition) {
final Animation mTransitionAnimation = new TranslateAnimation(0, 0, VIEW.getHeight()/2, 0);
mTransitionAnimation.setDuration(ANIMATION_DURATION);
mTransitionAnimation.setFillAfter(false);
mRevealAnimations.addAnimation(mTransitionAnimation);
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if(VIEW != null)
VIEW.startAnimation(mRevealAnimations);
}
}, delay);
return mRevealAnimations;
}
WelcomeSnowActy.java 文件源码
项目:QMark
阅读 29
收藏 0
点赞 0
评论 0
private AlphaAnimation startAlpha() {
AlphaAnimation alpha = new AlphaAnimation(0, 1);
alpha.setInterpolator(this, android.R.anim.accelerate_interpolator);
alpha.setStartOffset(0);
alpha.setDuration(1500);
return alpha;
}
QActionSheet.java 文件源码
项目:QActionSheet
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void show() {
super.show();
getWindow().setContentView(mParent);
AlphaAnimation anim = new AlphaAnimation(0, 1);
anim.setDuration(ANIMATION_DURATION);
mMaskView.setAnimation(anim);
int type = TranslateAnimation.RELATIVE_TO_SELF;
TranslateAnimation anim2 = new TranslateAnimation(type, 0, type, 0, type, 1, type, 0);
anim2.setDuration(ANIMATION_DURATION);
mPanel.setAnimation(anim2);
}