Search in sources :

Example 16 with AnimationSet

use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.

the class KJAnimations method openLoginAnim.

public static void openLoginAnim(View v) {
    AnimationSet set = new AnimationSet(true);
    v.measure(0, 0);
    set.addAnimation(getTranslateAnimation(0, 0, v.getMeasuredHeight(), 0, 600));
    set.addAnimation(getAlphaAnimation(0.8F, 1, 600));
    v.setAnimation(set);
}
Also used : AnimationSet(android.view.animation.AnimationSet)

Example 17 with AnimationSet

use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.

the class KJAnimations method clickCurtain.

public static void clickCurtain(View v) {
    AnimationSet set = new AnimationSet(false);
    Animation anim1 = getTranslateAnimation(0, 0, 0, -50, 110);
    Animation anim2 = getTranslateAnimation(0, 0, -50, 0, 80);
    Animation anim3 = getTranslateAnimation(0, 0, 0, -25, 25);
    Animation anim4 = getTranslateAnimation(0, 0, -25, 0, 25);
    anim1.setStartOffset(20);
    anim2.setStartOffset(230);
    anim3.setStartOffset(360);
    anim4.setStartOffset(400);
    set.addAnimation(anim1);
    set.addAnimation(anim2);
    set.addAnimation(anim3);
    set.addAnimation(anim4);
    v.startAnimation(set);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) AnimationSet(android.view.animation.AnimationSet)

Example 18 with AnimationSet

use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.

the class KJAnimations method closeAnimation.

/**
     * 关闭的动画
     * 
     * @param relativeLayout
     *            子菜单容器
     * @param background
     *            子菜单背景
     * @param menu
     *            菜单按钮
     * @param durationMillis
     *            动画时间
     */
public static void closeAnimation(final RelativeLayout relativeLayout, final ImageView menu, long durationMillis) {
    for (int i = 1; i < relativeLayout.getChildCount(); i++) {
        ImageView imageView = null;
        if (relativeLayout.getChildAt(i) instanceof ImageView) {
            imageView = (ImageView) relativeLayout.getChildAt(i);
        } else {
            continue;
        }
        AnimationSet set = new AnimationSet(true);
        set.addAnimation(getRotateAnimation(0, -360, durationMillis));
        set.addAnimation(getAlphaAnimation(1.0f, 0.5f, durationMillis));
        set.addAnimation(getTranslateAnimation(0, menu.getLeft() - imageView.getLeft(), 0, menu.getTop() - imageView.getTop(), durationMillis));
        set.setFillAfter(true);
        set.setDuration(durationMillis);
        set.setStartOffset(((relativeLayout.getChildCount() - i) * 100) / (-1 + relativeLayout.getChildCount()));
        set.setInterpolator(new AnticipateInterpolator(1f));
        set.setAnimationListener(new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation arg0) {
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {
            }

            @Override
            public void onAnimationEnd(Animation arg0) {
                relativeLayout.setVisibility(View.GONE);
            }
        });
        imageView.startAnimation(set);
    }
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 19 with AnimationSet

use of android.view.animation.AnimationSet in project android-satellite-menu by siyamed.

the class SatelliteAnimationCreator method createItemOutAnimation.

public static Animation createItemOutAnimation(Context context, int index, long expandDuration, int x, int y) {
    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
    long alphaDuration = 60;
    if (expandDuration < 60) {
        alphaDuration = expandDuration / 4;
    }
    alphaAnimation.setDuration(alphaDuration);
    alphaAnimation.setStartOffset(0);
    TranslateAnimation translate = new TranslateAnimation(0, x, 0, y);
    translate.setStartOffset(0);
    translate.setDuration(expandDuration);
    translate.setInterpolator(context, R.anim.sat_item_overshoot_interpolator);
    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setInterpolator(context, R.anim.sat_item_out_rotate_interpolator);
    long duration = 100;
    if (expandDuration <= 150) {
        duration = expandDuration / 3;
    }
    rotate.setDuration(expandDuration - duration);
    rotate.setStartOffset(duration);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(false);
    animationSet.setFillBefore(true);
    animationSet.setFillEnabled(true);
    //animationSet.addAnimation(alphaAnimation);
    //animationSet.addAnimation(rotate);
    animationSet.addAnimation(translate);
    animationSet.setStartOffset(30 * index);
    return animationSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 20 with AnimationSet

use of android.view.animation.AnimationSet in project platform_frameworks_base by android.

the class ListWithDisappearingItemBug method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Toast.makeText(this, "Make sure you rotate screen to see bug", Toast.LENGTH_LONG).show();
    // Get a cursor with all people
    Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
    startManagingCursor(c);
    ListAdapter adapter = new SimpleCursorAdapter(this, // Use a template that displays a text view
    R.layout.list_with_disappearing_item_bug_item, // Give the cursor to the list adatper
    c, // Map the NAME column in the people database to...
    new String[] { People.NAME }, // The "text1" view defined in the XML template
    new int[] { R.id.text1 });
    setListAdapter(adapter);
    AnimationSet set = new AnimationSet(true);
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(50);
    set.addAnimation(animation);
    animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(100);
    set.addAnimation(animation);
    LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
    ListView listView = getListView();
    listView.setLayoutAnimation(controller);
}
Also used : ListView(android.widget.ListView) SimpleCursorAdapter(android.widget.SimpleCursorAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) Cursor(android.database.Cursor) AnimationSet(android.view.animation.AnimationSet) ListAdapter(android.widget.ListAdapter) AlphaAnimation(android.view.animation.AlphaAnimation)

Aggregations

AnimationSet (android.view.animation.AnimationSet)117 AlphaAnimation (android.view.animation.AlphaAnimation)85 TranslateAnimation (android.view.animation.TranslateAnimation)75 Animation (android.view.animation.Animation)71 ScaleAnimation (android.view.animation.ScaleAnimation)69 ClipRectAnimation (android.view.animation.ClipRectAnimation)32 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)32 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)30 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)30 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)30 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)30 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)30 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)30 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)30 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)30 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)30 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)30 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)30 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)30 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)30