Example usage for android.view.animation ScaleAnimation setDuration

List of usage examples for android.view.animation ScaleAnimation setDuration

Introduction

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

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:Main.java

public static void btnScale(View view) {
    ScaleAnimation sa = new ScaleAnimation(0, 2, 0, 2);
    sa.setDuration(1000);
    view.startAnimation(sa);/*from  www. j  av a 2  s. co m*/
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float fromx, float tox, float fromy, float toy, long time) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromx, tox, fromy, toy);
    scaleAnimation.setDuration(time);
    return scaleAnimation;
}

From source file:Main.java

public static void setButtonEffect(View view) {
    AnimationSet animationSet = new AnimationSet(true);
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.02f, 1.01f, 1.02f, 1.01f);
    scaleAnimation.setDuration(300);
    animationSet.addAnimation(scaleAnimation);
    view.startAnimation(animationSet);//from  w  w w. j a v a2  s  .  c  o  m
}

From source file:Main.java

public static ScaleAnimation getScaleAnim(float fromScale, float toScale, long duration) {
    if (duration <= 0) {
        duration = DEFAULT_DURATION;//from  ww w. j a v a 2  s  .  c  om
    }
    ScaleAnimation anim = new ScaleAnimation(fromScale, toScale, fromScale, toScale, 0.5f, 0.5f);
    anim.setDuration(duration);
    anim.setFillAfter(true);
    return anim;
}

From source file:Main.java

public static void btnScaleSelf(View view) {
    ScaleAnimation sa = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5F,
            Animation.RELATIVE_TO_SELF, 0.5F);
    sa.setDuration(1000);
    view.startAnimation(sa);//from  w w w. j  a  v  a2  s.  c om
}

From source file:Main.java

public static void updateAnimation(final View v) {
    final ScaleAnimation scaleInAnimation = new ScaleAnimation(v.getX(), v.getX() + 1, v.getY(), v.getY() + 1,
            v.getPivotX(), v.getPivotY());
    scaleInAnimation.setDuration(200);
    scaleInAnimation.setFillAfter(false);
    v.startAnimation(scaleInAnimation);//from  w w  w  .ja v  a 2  s.  com
}

From source file:Main.java

public static void gridSelectionAnimation(View viewToAnimate) {
    ScaleAnimation animation = new ScaleAnimation(1.0f, 0.95f, 1.0f, 0.95f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(50);
    viewToAnimate.startAnimation(animation);
}

From source file:Main.java

public static void popup(View view) {

    AnimationSet animation = new AnimationSet(true);
    float pivotX = view.getWidth() / 2;
    float pivotY = view.getHeight() / 2;
    ScaleAnimation anim = new ScaleAnimation(0f, 1.1f, 0f, 1.1f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(300);
    animation.addAnimation(anim);/*  w w  w  .j  ava2 s . c  o  m*/

    anim = new ScaleAnimation(1.1f, 1f, 1.1f, 1f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(100);
    anim.setStartOffset(300);
    animation.addAnimation(anim);

    view.startAnimation(animation);
}

From source file:Main.java

public static void toBigAnim2(View view) {
    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(1000);
    animation.setFillAfter(false);//from www .ja v a 2 s .c om
    view.setAnimation(animation);
    animation.start();
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float start, float end, int duration) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(start, end, start, end, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setDuration(duration);
    scaleAnimation.setFillAfter(true);//from w  w w .  jav  a 2  s . com
    return scaleAnimation;
}