Example usage for android.view.animation TranslateAnimation TranslateAnimation

List of usage examples for android.view.animation TranslateAnimation TranslateAnimation

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation TranslateAnimation.

Prototype

public TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) 

Source Link

Document

Constructor to use when building a TranslateAnimation from code

Usage

From source file:Main.java

public static void SetImageSlide(View view, int startX, int toX, int startY, int toY) {
    TranslateAnimation anim = new TranslateAnimation(startX, toX, startY, toY);
    anim.setDuration(100);// ww  w  .  java2s  . c o m
    anim.setFillAfter(true);
    view.startAnimation(anim);
}

From source file:Main.java

public static Animation translateAnimation(int fromX, int toX, int fromY, int toY) {
    Animation animation = new TranslateAnimation(fromX, toX, fromY, toY);
    animation.setDuration(400);//from w  ww  .  ja  v a2 s. c  om
    return animation;
}

From source file:Main.java

public static void TranslateAnimation(View v, int startX, int toX, int startY, int toY, int time) {
    TranslateAnimation anim = new TranslateAnimation(startX, toX, startY, toY);
    anim.setDuration(time);/*from   w w  w. j  a v  a  2  s. c o m*/
    anim.setFillAfter(true);
    v.startAnimation(anim);
}

From source file:Main.java

public static void appearFromLeft(View target, long duration) {
    Animation animation = new TranslateAnimation(-target.getWidth(), 0, 0, 0);
    animation.setDuration(duration);/*w w  w .  j  ava2  s.  c  om*/
    //      animation.setFillAfter(true);
    target.startAnimation(animation);
    target.setVisibility(View.VISIBLE);
}

From source file:Main.java

public static Animation getYTranslate(float fromYDelta, float toYDelta, long duration) {
    TranslateAnimation animation = new TranslateAnimation(0, 0, fromYDelta, toYDelta);
    animation.setFillAfter(true);//  w  w w  .  j  av  a2s.c  o m
    animation.setDuration(duration);
    return animation;
}

From source file:Main.java

public static Animation shakeUpAndDownAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 0, 0, 10);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}

From source file:Main.java

public static void shakeAnim(View view) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(4));
    translateAnimation.setDuration(400);
    view.startAnimation(translateAnimation);
}

From source file:Main.java

public static Animation getTranslate(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
        long duration) {
    TranslateAnimation animation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
    animation.setFillAfter(true);//w  w  w  .jav a 2 s  .  c o m
    animation.setDuration(duration);
    return animation;
}

From source file:Main.java

public static Animation getTranlateAnmation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
        int millisSecond) {
    Animation animation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
    animation.setDuration(millisSecond);
    return animation;
}

From source file:Main.java

public static void startTranslateAnim(View view, float fromX, float toX, float fromY, float toY,
        long duration) {
    Animation anim = new TranslateAnimation(fromX, toX, fromY, toY);
    anim.setDuration(duration);//from   ww w . j  ava2 s.com
    anim.setFillAfter(true);
    view.startAnimation(anim);
}