use of android.view.animation.ScaleAnimation in project material-sheet-fab by gowong.
the class Fab method hide.
/**
* Hides the FAB.
*/
@Override
public void hide() {
// Only use scale animation if FAB is visible
if (getVisibility() == View.VISIBLE) {
// Pivots indicate where the animation begins from
float pivotX = getPivotX() + getTranslationX();
float pivotY = getPivotY() + getTranslationY();
// Animate FAB shrinking
ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
anim.setDuration(FAB_ANIM_DURATION);
anim.setInterpolator(getInterpolator());
startAnimation(anim);
}
setVisibility(View.INVISIBLE);
}
use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.
the class ViewUtils method elevateView.
public static void elevateView(final View view, boolean isAnimated, float scale) {
if (view == null) {
return;
}
ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, scale, 1.0f, scale, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
scaleAnimation.setDuration(isAnimated ? 150 : 0);
scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
scaleAnimation.setFillAfter(true);
view.clearAnimation();
view.startAnimation(scaleAnimation);
}
use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.
the class ViewUtils method zoomInView.
public static void zoomInView(final View view) {
if (view == null) {
return;
}
if (view.getVisibility() != View.VISIBLE) {
ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1f, 0, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(150);
scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
view.clearAnimation();
view.startAnimation(scaleAnimation);
view.setVisibility(View.VISIBLE);
}
}
use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.
the class ViewUtils method zoomOutView.
public static void zoomOutView(final View view) {
if (view == null) {
return;
}
if (view.getVisibility() != View.INVISIBLE) {
ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0, 1f, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(150);
scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
view.clearAnimation();
view.startAnimation(scaleAnimation);
view.setVisibility(View.INVISIBLE);
}
}
use of android.view.animation.ScaleAnimation in project LuaViewSDK by alibaba.
the class UDAnimation method build.
/**
* build an animation
*
* @return
*/
public Animation build(View view) {
Animation animation = null;
if (view != null) {
switch(mAnimationType) {
case TYPE_ALPHA:
if (this.mValues != null && this.mValues.length > 0) {
animation = new AlphaAnimation(view.getAlpha(), this.mValues[0]);
}
break;
case TYPE_ROTATE:
if (this.mValues != null && this.mValues.length > 0) {
animation = new RotateAnimation(view.getRotation(), this.mValues[0]);
}
break;
case TYPE_SCALE:
if (this.mValues != null && this.mValues.length > 1) {
animation = new ScaleAnimation(view.getScaleX(), this.mValues[0], view.getScaleY(), this.mValues[1]);
}
break;
case TYPE_TRANSLATE:
if (this.mValues != null && this.mValues.length > 1) {
animation = new TranslateAnimation(view.getX(), DimenUtil.dpiToPx(this.mValues[0]), view.getY(), DimenUtil.dpiToPx(this.mValues[1]));
}
break;
}
if (animation != null) {
animation.setFillEnabled(true);
//默认结束后设置属性
animation.setFillAfter(true);
animation.setFillBefore(true);
animation.setDuration(mDuration);
animation.setStartOffset(mStartOffset);
animation.setRepeatCount(mRepeatCount);
if (mOnStartCallback != null || mOnRepeatCallback != null || mOnEndCallback != null) {
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
LuaUtil.callFunction(mOnStartCallback);
}
@Override
public void onAnimationEnd(Animation animation) {
LuaUtil.callFunction(mOnEndCallback);
}
@Override
public void onAnimationRepeat(Animation animation) {
LuaUtil.callFunction(mOnRepeatCallback);
}
});
}
}
}
return animation;
}
Aggregations