notes In Path Animation - Android Animation

Android examples for Animation:Animation Creation

Description

notes 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 notesInPathAnimation() {

        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);/*w  w w.  j a v a2s  .  c o m*/
        rotate_360.setInterpolator(new LinearInterpolator());

        Animation step1 = new TranslateAnimation(Animation.ABSOLUTE, -580,
                Animation.ABSOLUTE, -520, Animation.ABSOLUTE, 720,
                Animation.ABSOLUTE, 200);
        step1.setDuration(300);
        step1.setInterpolator(new LinearInterpolator());

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

        return animationSet;

    }
}

Related Tutorials