List of usage examples for android.view.animation AccelerateInterpolator AccelerateInterpolator
public AccelerateInterpolator(float factor)
From source file:Main.java
/** * Expanding the view into matching the parent size * * @param v the target view/*from ww w .j a v a 2 s .c o m*/ */ public static void expand(final View v, int targetHeight) { int initialHeight = v.getMeasuredHeight(); int diffHeight = targetHeight - initialHeight; expand(v, diffHeight, 500, new AccelerateInterpolator(2), null); }
From source file:Main.java
public static AnimationSet RotateAndFadeOutAnimation() { AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f); fade_out.setDuration(500);//from www . j a v a 2 s .c o m fade_out.setStartOffset(0); fade_out.setFillAfter(true); ScaleAnimation shrink = new ScaleAnimation(1f, 0.2f, 1f, 0.2f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); shrink.setDuration(400); shrink.setStartOffset(0); shrink.setFillAfter(true); RotateAnimation rotate = new RotateAnimation(0.0f, 360f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); rotate.setDuration(500); rotate.setStartOffset(0); rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); AnimationSet Reload = new AnimationSet(true); Reload.addAnimation(fade_out); Reload.addAnimation(shrink); Reload.addAnimation(rotate); Reload.setInterpolator(new AccelerateInterpolator(1.1f)); return Reload; }
From source file:Main.java
public static void expandOrCollapse(final View v, boolean expand) { TranslateAnimation anim;//from w ww . j a v a2s . c o m if (expand) { anim = new TranslateAnimation(0.0f, 0.0f, -v.getHeight(), 0.0f); v.setVisibility(View.VISIBLE); } else { anim = new TranslateAnimation(0.0f, 0.0f, 0.0f, -v.getHeight()); Animation.AnimationListener collapselistener = new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Useless } @Override public void onAnimationRepeat(Animation animation) { // Useless } @Override public void onAnimationEnd(Animation animation) { v.setVisibility(View.GONE); } }; anim.setAnimationListener(collapselistener); } anim.setDuration(300); anim.setInterpolator(new AccelerateInterpolator(0.5f)); v.startAnimation(anim); }
From source file:com.savvasdalkitsis.betwixt.Interpolators.java
/** * <strong>ANDROID INTERPOLATOR</strong><br/><br/> * An interpolator where the rate of change starts out slowly and and then accelerates. * @param factor Degree to which the animation should be eased. Seting factor to 1.0f * produces a y=x^2 parabola. Increasing factor above 1.0f exaggerates the * ease-in effect (i.e., it starts even slower and ends evens faster) */// w w w .j a v a2 s . c om @NonNull public static Interpolator accelerate(float factor) { return new AccelerateInterpolator(factor); }
From source file:com.runmit.sweedee.view.flippablestackview.StackPageTransformer.java
/** * Used to construct the basic method for visual transformation in * <code>FlippableStackView</code>. * * @param numberOfStacked// ww w . j a v a 2s . c om * Number of pages stacked under the current page. * @param topStackedScale * Scale of the top stacked page. Must be a value from (0, * <code>currentPageScale</code>]. * @param overlapFactor * Defines the usage of available space for the overlapping by * stacked pages. Must be a value from [0, 1]. Value 1 means that * the whole available space (obtained due to the scaling with * <code>currentPageScale</code>) will be used for the purpose of * displaying stacked views. Value 0 means that no space will be * used for this purpose (in other words - no stacked views will * be visible). * @param gravity * Specifies the alignment of the stack (vertically) withing * <code>View</code> bounds. */ public StackPageTransformer(int numberOfStacked, float topStackedScale, float overlapFactor) { mNumberOfStacked = numberOfStacked; mAlphaFactor = 1.0f / (mNumberOfStacked + 1); mZeroPositionScale = 1.0f; mStackedScaleFactor = (1 - topStackedScale) / mNumberOfStacked; mOverlapFactor = overlapFactor; mScaleInterpolator = new DecelerateInterpolator(1.3f); mRotationInterpolator = new AccelerateInterpolator(0.6f); mValueInterpolator = new ValueInterpolator(0, 1, 0, mZeroPositionScale); }
From source file:com.jjoe64.graphview.series.BarGraphSeries.java
/** * creates bar series with data/* ww w .j av a 2 s . c o m*/ * * @param data data points * important: array has to be sorted from lowest x-value to the highest */ public BarGraphSeries(E[] data) { super(data); mPaint = new Paint(); mAnimationInterpolator = new AccelerateInterpolator(2f); }
From source file:android.improving.utils.views.cardsview.StackPageTransformer.java
/** * Used to construct the basic method for visual transformation in <code>FlippableStackView</code>. * * @param numberOfStacked Number of pages stacked under the current page. * @param orientation Orientation of the stack. * @param currentPageScale Scale of the current page. Must be a value from (0, 1]. * @param topStackedScale Scale of the top stacked page. Must be a value from * (0, <code>currentPageScale</code>]. * @param overlapFactor Defines the usage of available space for the overlapping by stacked * pages. Must be a value from [0, 1]. Value 1 means that the whole * available space (obtained due to the scaling with * <code>currentPageScale</code>) will be used for the purpose of displaying * stacked views. Value 0 means that no space will be used for this purpose * (in other words - no stacked views will be visible). * @param gravity Specifies the alignment of the stack (vertically) withing <code>View</code> * bounds./*from w w w. j a v a 2s . c o m*/ */ public StackPageTransformer(int numberOfStacked, Orientation orientation, float currentPageScale, float topStackedScale, float overlapFactor, Gravity gravity) { validateValues(currentPageScale, topStackedScale, overlapFactor); mNumberOfStacked = numberOfStacked; mAlphaFactor = 1.0f / (mNumberOfStacked + 1); mZeroPositionScale = currentPageScale; mStackedScaleFactor = (currentPageScale - topStackedScale) / mNumberOfStacked; mOverlapFactor = overlapFactor; mOrientation = orientation; mGravity = gravity; mScaleInterpolator = new DecelerateInterpolator(1.3f); mRotationInterpolator = new AccelerateInterpolator(0.6f); mValueInterpolator = new ValueInterpolator(0, 1, 0, mZeroPositionScale); }
From source file:id.zelory.tanipedia.activity.JawabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jawab); Toolbar toolbar = (Toolbar) findViewById(R.id.anim_toolbar); setSupportActionBar(toolbar);/*w ww.j a v a2 s . c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle("Tanya Tani"); soal = getIntent().getParcelableExtra("soal"); try { idSoal = URLEncoder.encode(soal.getId(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow); fabMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin); recyclerView = (RecyclerView) findViewById(R.id.scrollableview); recyclerView.setHasFixedSize(true); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.addOnScrollListener(new MyRecyclerScroll() { @Override public void show() { fab.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start(); } @Override public void hide() { fab.animate().translationY(fab.getHeight() + fabMargin) .setInterpolator(new AccelerateInterpolator(2)).start(); } }); fab = (FrameLayout) findViewById(R.id.myfab_main); fabBtn = (ImageButton) findViewById(R.id.myfab_main_btn); View fabShadow = findViewById(R.id.myfab_shadow); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fabShadow.setVisibility(View.GONE); fabBtn.setBackground(getDrawable(R.drawable.ripple_accent)); } fab.startAnimation(animation); fabBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new MaterialDialog.Builder(JawabActivity.this).title("TaniPedia").content("Kirim Jawaban") .inputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_CLASS_TEXT) .input("Ketik jawaban anda disini!", null, false, new MaterialDialog.InputCallback() { @Override public void onInput(MaterialDialog dialog, CharSequence input) { try { jawaban = URLEncoder.encode(input.toString(), "UTF-8"); new KirimJawaban().execute(); } catch (UnsupportedEncodingException e) { Snackbar.make(fabBtn, "Terjadi kesalahan, silahkan coba lagi!", Snackbar.LENGTH_LONG).show(); e.printStackTrace(); } } }).positiveColorRes(R.color.primary_dark).positiveText("Kirim") .cancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }).negativeColorRes(R.color.primary_dark).negativeText("Batal").show(); } }); fabButton = (FabButton) findViewById(R.id.determinate); fabButton.showProgress(true); new DownloadData().execute(); fabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fabButton.showProgress(true); new DownloadData().execute(); } }); }
From source file:com.jjoe64.graphview.series.LineGraphSeries.java
/** * do the initialization//from www. j a v a 2s . c om * creates internal objects */ protected void init() { mStyles = new Styles(); mPaint = new Paint(); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStyle(Paint.Style.STROKE); mPaintBackground = new Paint(); mPathBackground = new Path(); mPath = new Path(); mAnimationInterpolator = new AccelerateInterpolator(2f); }
From source file:com.chrynan.guitartuner.PitchFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public Animator unreveal(final float x, final float y) { Animator anim = ViewAnimationUtils.createCircularReveal(getView(), (int) x, (int) y, (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()), 0); anim.setInterpolator(new AccelerateInterpolator(0.5f)); anim.setDuration(500);//from w ww .j a va 2 s. c o m return anim; }