make Snake ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

make Snake ObjectAnimator

Demo Code


//package com.java2s;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.CycleInterpolator;

public class Main {

    public static void makeSnake(View v) {
        ObjectAnimator snake = ObjectAnimator.ofFloat(v, "translationX", 0,
                10).setDuration(300);/*from  w  ww. j  a  va 2 s  .  c  om*/
        snake.setInterpolator(new CycleInterpolator(2));
        snake.start();
    }
}

Related Tutorials