List of usage examples for android.view.animation ScaleAnimation ScaleAnimation
public ScaleAnimation(float fromX, float toX, float fromY, float toY, float pivotX, float pivotY)
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);/*from w ww .j a v a 2 s .c o m*/ scaleInAnimation.setFillAfter(false); v.startAnimation(scaleInAnimation); }
From source file:Main.java
public static ScaleAnimation getScaleAnim(float fromScale, float toScale, long duration) { if (duration <= 0) { duration = DEFAULT_DURATION;//from ww w . jav 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 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);// w w w . java 2 s .com animation.addAnimation(anim); 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 setOnTouchScaleAnimation(View targetView, final float scaleX, final float scaleY) { targetView.setOnTouchListener(new View.OnTouchListener() { @Override/*from w w w . jav a 2s. c o m*/ public boolean onTouch(View v, MotionEvent event) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: { ScaleAnimation anim = new ScaleAnimation(1.0f, scaleX, 1.0f, scaleY, v.getWidth() / 2, v.getHeight() / 2); anim.setDuration(60); anim.setFillEnabled(true); anim.setFillAfter(true); v.startAnimation(anim); break; } case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: { ScaleAnimation anim = new ScaleAnimation(scaleX, 1.0f, scaleY, 1.0f, v.getWidth() / 2, v.getHeight() / 2); anim.setDuration(100); v.startAnimation(anim); break; } } return false; } }); }
From source file:Main.java
public static void shrinkToLeft(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200);//from w w w . j a v a2 s . c o m anim.setStartOffset(200); //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) -(screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
From source file:Main.java
public static void enlargeToRight(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(0.8f, 1f, 0.8f, 1f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200);/*ww w .j a v a 2 s .c o m*/ anim.setStartOffset(200); //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) (screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
From source file:Main.java
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }
From source file:Main.java
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }
From source file:Main.java
/** * push View ScaleAnimation//from ww w . j a va 2 s . c om * * @param targetView TargetView * @param action MotionEventAction * @param scaleX * @param scaleY */ private static void pushScale(View targetView, int action, float scaleX, float scaleY) { if (action == MotionEvent.ACTION_DOWN) { // Touch Down ScaleAnimation anim = new ScaleAnimation(1.0f, scaleX, 1.0f, scaleY, targetView.getWidth() / 2, targetView.getHeight() / 2); anim.setDuration(DURATION); anim.setFillEnabled(true); anim.setFillAfter(true); targetView.startAnimation(anim); } else if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) { // Touch Up ScaleAnimation anim = new ScaleAnimation(scaleX, 1.0f, scaleY, 1.0f, targetView.getWidth() / 2, targetView.getHeight() / 2); anim.setDuration(DURATION); anim.setFillEnabled(true); anim.setFillAfter(true); targetView.startAnimation(anim); } }
From source file:com.chinabike.plugins.mip.activity.LocalAlbumDetail.java
private void showViewPager(int index) { pagerContainer.setVisibility(View.VISIBLE); gridView.setVisibility(View.GONE); findViewById(FakeR.getId(this, "id", "album_title_bar")).setVisibility(View.GONE); viewpager.setAdapter(viewpager.new LocalViewPagerAdapter(currentFolder)); viewpager.setCurrentItem(index);//ww w.j a va 2 s . c o m mCountView.setText((index + 1) + "/" + currentFolder.size()); //? if (index == 0) { checkBox.setTag(currentFolder.get(index)); checkBox.setChecked(checkedItems.contains(currentFolder.get(index))); } AnimationSet set = new AnimationSet(true); ScaleAnimation scaleAnimation = new ScaleAnimation((float) 0.9, 1, (float) 0.9, 1, pagerContainer.getWidth() / 2, pagerContainer.getHeight() / 2); scaleAnimation.setDuration(300); set.addAnimation(scaleAnimation); AlphaAnimation alphaAnimation = new AlphaAnimation((float) 0.1, 1); alphaAnimation.setDuration(200); set.addAnimation(alphaAnimation); pagerContainer.startAnimation(set); }