get Wave Layout Animation Controller - Android Animation

Android examples for Animation:Animation Controller

Description

get Wave Layout Animation Controller

Demo Code


//package com.java2s;

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

import android.view.animation.LayoutAnimationController;

import android.view.animation.ScaleAnimation;

public class Main {

    public static LayoutAnimationController getWaveLayoutAnimationController() {
        AnimationSet set = new AnimationSet(true);

        Animation animation = new AlphaAnimation(0.0f, 1.0f);
        animation.setDuration(100);//from w  w  w .  j  av  a 2 s. co  m
        set.addAnimation(animation);

        animation = new ScaleAnimation(0.5f, 1.5f, 0.5f, 1.5f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animation.setDuration(200);
        set.addAnimation(animation);

        animation = new ScaleAnimation(1.5f, 1f, 1.5f, 1f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animation.setDuration(100);
        animation.setStartOffset(200);
        set.addAnimation(animation);

        LayoutAnimationController controller = new LayoutAnimationController(
                set, 0.5f);
        return controller;
    }
}

Related Tutorials