contacts In Path Animation - Android Animation

Android examples for Animation:Animation Creation

Description

contacts In Path Animation

Demo Code

//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.AnimationSet;

import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;

import android.view.animation.TranslateAnimation;

public class Main {
    static public Animation contactsInPathAnimation() {

        AnimationSet animationSet = new AnimationSet(true);
        RotateAnimation rotate_360 = new RotateAnimation(0, 720,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        rotate_360.setDuration(900);/*from ww w.j a va  2  s  .c om*/
        rotate_360.setInterpolator(new LinearInterpolator());

        Animation step1 = new TranslateAnimation(Animation.ABSOLUTE, -320,
                Animation.ABSOLUTE, -280, Animation.ABSOLUTE, 280,
                Animation.ABSOLUTE, 0);
        step1.setDuration(300);
        step1.setInterpolator(new LinearInterpolator());

        Animation inFromLeft = new TranslateAnimation(Animation.ABSOLUTE,
                0, Animation.ABSOLUTE, 280, Animation.RELATIVE_TO_PARENT,
                0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
        inFromLeft.setDuration(500);
        inFromLeft.setInterpolator(new LinearInterpolator());
        animationSet.addAnimation(rotate_360);
        animationSet.addAnimation(step1);
        animationSet.addAnimation(inFromLeft);

        return animationSet;

    }
}

Related Tutorials