List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:Main.java
public static void animateScaleIn(View view, long duration, Animator.AnimatorListener listener) { view.setScaleX(0f);/*from w ww . j a v a 2s . com*/ view.setScaleY(0f); view.setVisibility(View.VISIBLE); AnimatorSet scaleSet = new AnimatorSet(); scaleSet.playTogether(ObjectAnimator.ofFloat(view, View.SCALE_X, 1f), ObjectAnimator.ofFloat(view, View.SCALE_Y, 1f)); scaleSet.setInterpolator(new AccelerateDecelerateInterpolator()); scaleSet.setDuration(duration); if (listener != null) { scaleSet.addListener(listener); } scaleSet.start(); //return scaleSet; }
From source file:Main.java
public static void animateTextChange(final TextView view, @IdRes final int toText, final Runnable rWhenEnd) { ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f); final ObjectAnimator restore = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); alpha.setDuration(DURATION_SHORT);//from w ww . java2 s .c om alpha.setInterpolator(new AccelerateDecelerateInterpolator()); restore.setDuration(DURATION_SHORT); restore.setInterpolator(new AccelerateDecelerateInterpolator()); alpha.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { // Do nothing. } @SuppressWarnings("ResourceType") @Override public void onAnimationEnd(Animator animation) { view.setText(toText); restore.start(); } @SuppressWarnings("ResourceType") @Override public void onAnimationCancel(Animator animation) { view.setText(toText); } @Override public void onAnimationRepeat(Animator animation) { // Do nothing. } }); if (rWhenEnd != null) restore.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { rWhenEnd.run(); } @Override public void onAnimationCancel(Animator animation) { rWhenEnd.run(); } @Override public void onAnimationRepeat(Animator animation) { } }); alpha.start(); }
From source file:Main.java
public static void postAnimationBottom(final View childLayout, int delay, final int duration) { int visibility = childLayout.getVisibility(); if (visibility != View.VISIBLE) { return;//from w w w . j a v a 2 s . c o m } childLayout.setVisibility(View.INVISIBLE); childLayout.postDelayed(new Runnable() { @Override public void run() { childLayout.setVisibility(View.VISIBLE); AnimationSet animationSet = new AnimationSet(true); animationSet.setDuration(duration); animationSet.setInterpolator(new AccelerateDecelerateInterpolator()); int pivotXType = Animation.RELATIVE_TO_SELF; animationSet.addAnimation( new TranslateAnimation(pivotXType, 0, pivotXType, 0, pivotXType, 1, pivotXType, 0)); animationSet.addAnimation(new AlphaAnimation(0, 1)); childLayout.startAnimation(animationSet); } }, delay); }
From source file:Main.java
/** * This method creates an Object Animator based on the targeted view, the property to be * animated and the initial value and final value * * @param view//from ww w.j av a2 s . c o m * Target view * @param property * Property to be animated * @param init * Initial value * @param end * Final value * @param duration * Animation duration * * @return ObjectAnimator with the given animated property */ @NonNull public static ObjectAnimator createObjectAnimator(View view, String property, float init, float end, long duration) { ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(view, property, init, end); scaleXAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); scaleXAnimation.setDuration(duration); return scaleXAnimation; }
From source file:Main.java
public static void breath(View v, float fromRange, float toRange, long duration) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, fromRange, toRange); animator.setDuration(duration);//from w w w .j av a2 s .co m animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.start(); }
From source file:Main.java
/** * Creates an animation that rotates an {@link ImageView} * around the Y axis by 180 degrees and changes the image * resource shown when the view is rotated 90 degrees to the user. * * @param imageView the view to rotate. * @param drawableRes the drawable to set when the view * is rotated by 90 degrees. * @return an animation that will change the image shown by the view. *//* w ww . jav a 2 s . com*/ @NonNull public static Animation createRotationTransitionAnimation(@NonNull final ImageView imageView, @DrawableRes final int drawableRes) { Animation animation = new Animation() { private boolean mSetFinalDrawable; @Override protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime < 0.5f) { imageView.setRotationY(90 * interpolatedTime * 2f); } else { if (!mSetFinalDrawable) { mSetFinalDrawable = true; imageView.setImageResource(drawableRes); } imageView.setRotationY((-90) + (90 * (interpolatedTime - 0.5f) * 2f)); } } }; animation.setDuration(300); animation.setInterpolator(new AccelerateDecelerateInterpolator()); return animation; }
From source file:com.bobomee.android.navigator.expandable.Utils.java
/** * Creates interpolator./* w ww . ja va2 s .c o m*/ * @return a timeinterpolator * @param interpolatorType a int value from 0 to 10 */ public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) { switch (interpolatorType) { case ACCELERATE_DECELERATE_INTERPOLATOR: return new AccelerateDecelerateInterpolator(); case ACCELERATE_INTERPOLATOR: return new AccelerateInterpolator(); case ANTICIPATE_INTERPOLATOR: return new AnticipateInterpolator(); case ANTICIPATE_OVERSHOOT_INTERPOLATOR: return new AnticipateOvershootInterpolator(); case BOUNCE_INTERPOLATOR: return new BounceInterpolator(); case DECELERATE_INTERPOLATOR: return new DecelerateInterpolator(); case FAST_OUT_LINEAR_IN_INTERPOLATOR: return new FastOutLinearInInterpolator(); case FAST_OUT_SLOW_IN_INTERPOLATOR: return new FastOutSlowInInterpolator(); case LINEAR_INTERPOLATOR: return new LinearInterpolator(); case LINEAR_OUT_SLOW_IN_INTERPOLATOR: return new LinearOutSlowInInterpolator(); case OVERSHOOT_INTERPOLATOR: return new OvershootInterpolator(); default: return new LinearInterpolator(); } }
From source file:Main.java
public static void animateTextChange(final TextView view, final String toText) { ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f); final ObjectAnimator restore = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); alpha.setDuration(DURATION_SHORT);//from www .j a v a 2 s . c o m alpha.setInterpolator(new AccelerateDecelerateInterpolator()); restore.setDuration(DURATION_SHORT); restore.setInterpolator(new AccelerateDecelerateInterpolator()); alpha.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { // Do nothing. } @Override public void onAnimationEnd(Animator animation) { view.setText(toText); restore.start(); } @Override public void onAnimationCancel(Animator animation) { view.setText(toText); } @Override public void onAnimationRepeat(Animator animation) { // Do nothing. } }); alpha.start(); }
From source file:de.uni_weimar.m18.anatomiederstadt.SplashActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); final PathView pathView = (PathView) findViewById(R.id.pathView); pathView.useNaturalColors();/*from ww w.ja v a2 s .c om*/ int pathDelay = 1000; int pathDuration = 2500; final Animation a = new AlphaAnimation(0.00f, 1.00f); a.setStartOffset(3500); a.setDuration(1000); //pathView.setSvgResource(R.raw.vitruvian_man_weimar_kk3); pathView.getPathAnimator().delay(pathDelay).duration(pathDuration) .interpolator(new AccelerateDecelerateInterpolator()).start(); final ImageView logoImage = (ImageView) findViewById(R.id.logoImage); a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoImage.setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { launchMainActivity(); } }, 1500); } @Override public void onAnimationRepeat(Animation animation) { } }); logoImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { launchMainActivity(); } }); logoImage.startAnimation(a); }
From source file:io.github.marktony.espresso.mvp.companydetails.CompanyDetailActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.container);/* w ww. j a v a 2s . c o m*/ // Set the navigation bar color if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) { getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); } Explode explode = new Explode(); explode.setDuration(500); explode.setInterpolator(new AccelerateDecelerateInterpolator()); getWindow().setEnterTransition(explode); if (savedInstanceState != null) { fragment = (CompanyDetailFragment) getSupportFragmentManager().getFragment(savedInstanceState, "CompanyDetailFragment"); } else { fragment = CompanyDetailFragment.newInstance(); } if (!fragment.isAdded()) { getSupportFragmentManager().beginTransaction().add(R.id.container, fragment, "CompanyDetailFragment") .commit(); } new CompanyDetailPresenter(fragment, CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()), getIntent().getStringExtra(COMPANY_ID)); }