Android ScaleAnimation - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ScaleAnimation class.

This code example shows how to use the following methods:setDuration, setRepeatCount, setRepeatMode
        final BitmapsView view = new BitmapsView(this);
        final FrameLayout layout = new FrameLayout(this);
        layout.addView(view, new FrameLayout.LayoutParams(480, 800, Gravity.CENTER));
        setContentView(layout);
         
        ScaleAnimation a = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF,0.5f);
        a.setDuration(2000);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        view.startAnimation(a);
    } 
 
    static class BitmapsView extends View {
        private Paint mBitmapPaint;
        private final Bitmap mBitmap1;
        private final Bitmap mBitmap2;
        private final PorterDuffXfermode mDstIn;
 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, setRepeatCount, setRepeatMode
        final BitmapsView view = new BitmapsView(this);
        final FrameLayout layout = new FrameLayout(this);
        layout.addView(view, new FrameLayout.LayoutParams(480, 800, Gravity.CENTER));
        setContentView(layout);
         
        ScaleAnimation a = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF,0.5f);
        a.setDuration(2000);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        view.startAnimation(a);
    } 
 
    static class BitmapsView extends View {
        private Paint mBitmapPaint;
        private final Bitmap mBitmap1;
        private final Bitmap mBitmap2;
        private final PorterDuffXfermode mDstIn;
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, setInterpolator
        mImageView.startAnimation(animation);
    } 
 
    public void startScale(View view) {
        ScaleAnimation animation;
        animation = new ScaleAnimation(1, 2, 1, 2, mImageView.getWidth() / 2.0F, mImageView.getHeight() / 2.0F);
        // 3秒で 
        animation.setDuration(3000);
        animation.setInterpolator(this, android.R.anim.bounce_interpolator);
        mImageView.startAnimation(animation);
    } 
 
    public void startRotate(View view) {
        RotateAnimation animation;
        animation = new RotateAnimation(0, 360, mImageView.getWidth() / 2.0F, mImageView.getHeight() / 2.0F);
        // 3秒で 
        animation.setDuration(3000);
        mImageView.startAnimation(animation);
    } 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAnimationListener, setDuration
 
public class AnimationTricks { 
 
	public static Animation createHeightChangeAnimation(int oldHeight, int newHeight, int duration, AnimationListener listener) {
		float targetScale = (float)newHeight / (float)oldHeight;
		ScaleAnimation anim = new ScaleAnimation(1, 1, 1.0f, targetScale);
		anim.setDuration(duration);
		anim.setAnimationListener(listener);
		return anim;
	} 
	 
	public static Animation createFadeAnimation(boolean out, int duration, AnimationListener listener) {
		AlphaAnimation anim = new AlphaAnimation((out ? 1.0f : 0.0f), (out ? 0.0f : 1.0f));
		anim.setDuration(duration);
		anim.setAnimationListener(listener);
		return anim;
	} 
	 
    public static Animation createSlideAnimation(boolean relToParent, boolean horizontal, boolean fromLeftOrTop, boolean exiting, int duration) {
        int rel = (relToParent ? Animation.RELATIVE_TO_PARENT : Animation.RELATIVE_TO_SELF);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration
        int x = getCoorFromIndex(dragged).x + childWidth / 2, y = getCoorFromIndex(dragged).y
                + childWidth / 2;
        int l = x - (3 * childWidth / 4), t = y - (3 * childHeight / 4);
        v.layout(l, t, l + (childWidth * 3 / 2), t + (childHeight * 3 / 2));
        AnimationSet animSet = new AnimationSet(true);
        ScaleAnimation scale = new ScaleAnimation(.667f, 1, .667f, 1,
                childWidth * 3 / 4, childHeight * 3 / 4);
        scale.setDuration(animT);
        AlphaAnimation alpha = new AlphaAnimation(1, .5f);
        alpha.setDuration(animT);
 
        animSet.addAnimation(scale);
        animSet.addAnimation(alpha);
        animSet.setFillEnabled(true);
        animSet.setFillAfter(true);
 
        v.clearAnimation();
        v.startAnimation(animSet);
    } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, setFillAfter, setFillBefore, setRepeatCount, setRepeatMode
This code example shows how to use the following methods:setAnimationListener, setDuration
 
public class AnimationTricks { 
 
	public static Animation createHeightChangeAnimation(int oldHeight, int newHeight, int duration, AnimationListener listener) {
		float targetScale = (float)newHeight / (float)oldHeight;
		ScaleAnimation anim = new ScaleAnimation(1, 1, 1.0f, targetScale);
		anim.setDuration(duration);
		anim.setAnimationListener(listener);
		return anim;
	} 
	 
	public static Animation createFadeAnimation(boolean out, int duration, AnimationListener listener) {
		AlphaAnimation anim = new AlphaAnimation((out ? 1.0f : 0.0f), (out ? 0.0f : 1.0f));
		anim.setDuration(duration);
		anim.setAnimationListener(listener);
		return anim;
	} 
	 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, setInterpolator
        mImageView.startAnimation(animation);
    } 
 
    public void startScale(View view) {
        ScaleAnimation animation;
        animation = new ScaleAnimation(1, 2, 1, 2, mImageView.getWidth() / 2.0F,
                mImageView.getHeight() / 2.0F);
        // 3秒で 
        animation.setDuration(3000);
        animation.setInterpolator(this, android.R.anim.bounce_interpolator);
        mImageView.startAnimation(animation);
    } 
 
    public void startRotate(View view) {
        RotateAnimation animation;
        animation = new RotateAnimation(0, 360, mImageView.getWidth() / 2.0F,
                mImageView.getHeight() / 2.0F);
        // 3秒で 
        animation.setDuration(3000);
        mImageView.startAnimation(animation);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration
    	View v = getChildAt(dragged);
    	int x = getCoorFromIndex(dragged).x + childSize / 2, y = getCoorFromIndex(dragged).y + childSize / 2;
        int l = x - (3 * childSize / 4), t = y - (3 * childSize / 4);
    	v.layout(l, t, l + (childSize * 3 / 2), t + (childSize * 3 / 2));
    	AnimationSet animSet = new AnimationSet(true);
		ScaleAnimation scale = new ScaleAnimation(.667f, 1, .667f, 1, childSize * 3 / 4, childSize * 3 / 4);
		scale.setDuration(animT);
		AlphaAnimation alpha = new AlphaAnimation(1, .5f);
		alpha.setDuration(animT);
 
		animSet.addAnimation(scale);
		animSet.addAnimation(alpha);
		animSet.setFillEnabled(true);
		animSet.setFillAfter(true);
		 
		v.clearAnimation();
		v.startAnimation(animSet);
    } 
    protected void animateGap(int target)
    { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, setFillAfter, setRepeatMode
		vw.setScaleType(ScaleType.FIT_CENTER);
		return vw;
	} 
	@Override 
	public Animation getOpenAnimation() {
		Animation _animation = new ScaleAnimation(0,  1,0, 1,Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.6);
		_animation.setDuration(500);
        _animation.setFillAfter(true);
		_animation.setRepeatMode(Animation.REVERSE);
		return _animation;
	} 
	@Override 
	public Animation getCloseAnimation() {
		Animation _animation = new ScaleAnimation(1,0, 1, 0,Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.6);
        _animation.setDuration(500);
        _animation.setFillAfter(true);
         
		return _animation;
	} 
	} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android ScaleAnimation Questions & Answers:

See Code Examples for Android ScaleAnimation Methods: