centre Spin View In Animation - Android Animation

Android examples for Animation:Spin Animation

Description

centre Spin View In Animation

Demo Code


//package com.java2s;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;

public class Main {
    private static final long SPIN_HALFPOINT = 500;

    public static Animation centreSpinViewInAnimation() {
        Animation spin = new ScaleAnimation(0, 1, 1, 1,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        spin.setStartOffset(SPIN_HALFPOINT);
        spin.setDuration(SPIN_HALFPOINT);
        spin.setInterpolator(new AccelerateDecelerateInterpolator());
        return spin;
    }//from   w  w  w  . j a v a 2s . c o m
}

Related Tutorials