public void run(AnimationObject object, Object animation, String value){ ((Animation)animation).setFillBefore(RapidStringUtils.stringToBoolean(value)); } }
Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); // add this fadeIn.setDuration(fadeInDuration); fadeIn.setFillEnabled(true); // to apply setFillBefore and setFillAfter fadeIn.setFillBefore(true); // it means that at start of animation you set alpha="0" fadeIn.setFillAfter(false); iv.setAnimation(fadeIn); iv.startAnimation(fadeIn);
/***************************************************** * * Starts the display cycle. * *****************************************************/ public void startDisplayCycle() { mPromptTextView.setVisibility( View.VISIBLE ); mInAnimation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1f, Animation.RELATIVE_TO_SELF, 0 ); mInAnimation.setDuration( IN_ANIMATION_DURATION_MILLIS ); mInAnimation.setFillBefore( true ); mInAnimation.setFillAfter( true ); mInAnimation.setAnimationListener( new OutAnimationTrigger() ); mPromptTextView.startAnimation( mInAnimation ); }
/***************************************************** * * Called after a delay whilst the prompt text is displayed * on screen. * *****************************************************/ @Override public void run() { // Create and start the out animation. Once the out animation // has finished, we clear the animation and hide the view. Animation outAnimation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1f ); outAnimation.setDuration( OUT_ANIMATION_DURATION_MILLIS ); outAnimation.setFillBefore( true ); outAnimation.setFillAfter( true ); outAnimation.setAnimationListener( new VisibilitySettingAnimationListener( mPromptTextView, View.GONE ) ); mPromptTextView.startAnimation( outAnimation ); } }
Animation.RELATIVE_TO_SELF, 0f); // Pivot point of Y scaling anim.setFillAfter(true); // Needed to keep the result of the animation anim.setFillBefore(false); anim.setFillEnabled(true); anim.setDuration(ANIM_TIME);
public LabelView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); _animation.setFillBefore(true); _animation.setFillAfter(true); _animation.setFillEnabled(true); }
translateAnim.setFillAfter(true); translateAnim.setFillEnabled(true); translateAnim.setFillBefore(false); translateAnim.setAnimationListener(new Animation.AnimationListener() { @Override
a.setDuration(500); a.setFillAfter(false); a.setFillBefore(false); a.setFillEnabled(true); set.addAnimation(a); a.setDuration(500); a.setFillAfter(false); a.setFillBefore(false); a.setFillEnabled(true); set.addAnimation(a);
/** * Creates the moving animation * <p> * Configures the moving animation based on moving params * * @param params params, which is used to configure the moving animation * @return moving animation */ private Animation createAnimation(MovingParams params) { Animation animation = new TranslateAnimation(0, params.getXAxisDelta(), 0, params.getYAxisDelta()); animation.setFillEnabled(true); animation.setFillBefore(false); animation.setDuration(params.getAnimationDuration()); Interpolator interpolator = params.getAnimationInterpolator(); if (interpolator != null) { animation.setInterpolator(interpolator); } animation.setAnimationListener(new MoveAnimationListener(params)); return animation; }
ScaleAnimation.ABSOLUTE, 250); rectAnim1.setFillBefore(false); rectAnim1.setFillAfter(true); rectAnim1.setStartOffset(500);
anim.setFillBefore(fillBefore);
AnimationSet anim = new AnimationSet(false); final Animation ballInAnimation = AnimationUtils.loadAnimation(this, R.anim.ball_in); ballInAnimation.setFillBefore(true); final Animation ballShiftAnimation = AnimationUtils.loadAnimation(this,R.anim.ball_shift); ballShiftAnimation.setStartOffset(ballInAnimation.getDuration()); final Animation ballOutAnimation = AnimationUtils.loadAnimation(this,R.anim.ball_out); ballOutAnimation.setStartOffset(ballInAnimation.getDuration()+ ballShiftAnimation.getDuration()); anim.addAnimation(ballInAnimation); anim.addAnimation(ballShiftAnimation); anim.addAnimation(ballOutAnimation); anim.setFillAfter(true); ballImage.startAnimation(anim);