tasks In Path Animation - Android Animation

Android examples for Animation:Animation Creation

Description

tasks 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 tasksInPathAnimation() {

        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 w w  w.  ja  v  a2  s .  c  o  m*/
        rotate_360.setInterpolator(new LinearInterpolator());

        Animation step1 = new TranslateAnimation(Animation.ABSOLUTE, -640,
                Animation.ABSOLUTE, -580, Animation.ABSOLUTE, 540,
                Animation.ABSOLUTE, 82);
        step1.setDuration(300);
        step1.setInterpolator(new LinearInterpolator());

        Animation inFromLeft = new TranslateAnimation(Animation.ABSOLUTE,
                0, Animation.ABSOLUTE, 580, Animation.ABSOLUTE, 0,
                Animation.ABSOLUTE, -82);
        inFromLeft.setDuration(500);
        inFromLeft.setInterpolator(new LinearInterpolator());
        animationSet.addAnimation(rotate_360);
        animationSet.addAnimation(step1);
        animationSet.addAnimation(inFromLeft);

        return animationSet;

    }
}

Related Tutorials