List of usage examples for android.animation AnimatorSet setDuration
@Override public AnimatorSet setDuration(long duration)
From source file:cn.edu.zucc.list.FabAnimation.MorphDialogToFab.java
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {//from ww w.j a v a 2 s.c om Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; } Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS); if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) { return null; } MorphDrawable background = new MorphDrawable(startColor, startCornerRadius); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius); // hide child views (offset down & fade out) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L) .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)) .start(); } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); transition.setDuration(300); return transition; }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateInFrameDetails() { frameDetails.setVisibility(View.VISIBLE); ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override//from w ww. j ava 2 s . c o m public void run() { ObjectAnimator alpha = ofFloat(frameDetails, View.ALPHA, 0.4f, 1f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new LinearOutSlowInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameMaster.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:com.liyu.huahui.ui.widgets.MorphDialogToFab.java
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override// w ww. ja v a2s . c o m public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; } Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS); if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) { return null; } MorphDrawable background = new MorphDrawable(startColor, startCornerRadius); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius); // hide child views (offset down & fade out) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L) .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)) .start(); } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); transition.setDuration(300); return transition; }
From source file:com.wolski_msk.collector.sample.transition.MorphDialogToFab.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//from w ww . j a v a 2 s . c o m public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; } Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS); if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) { return null; } MorphDrawable background = new MorphDrawable(startColor, startCornerRadius); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius); // hide child views (offset down & fade out) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L) .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)) .start(); } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); transition.setDuration(300); return transition; }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateOutFrameDetails() { ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override//from www .ja v a 2s .c om public void run() { if (!frameDetails.isShown()) { return; } ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 1f, 0f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, 0f, frameDetails.getHeight() * 0.3f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new FastOutLinearInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameDetails.setAlpha(1f); frameDetails.setTranslationY(0); frameDetails.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java
public void drawFail() { mState = State.STATE_FAILED;/*from ww w. ja v a2 s .c o m*/ ObjectAnimator failAnim = ObjectAnimator.ofFloat(this, "failAngle", 0, 180); failAnim.setInterpolator(new OvershootInterpolator()); //This one doesn't do much actually, we just use it to take advantage of associating two different interpolators ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget); anim.setInterpolator(new AccelerateInterpolator()); AnimatorSet set = new AnimatorSet(); set.setDuration((long) (ANIMATION_DURATION_BASE / 1.7f)); set.playTogether(failAnim, anim); set.start(); }
From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java
private void animateContent() { View avatar1 = findViewById(R.id.avatar1); avatar1.setScaleX(0);//w w w . jav a 2s .c o m avatar1.setScaleY(0); avatar1.setVisibility(View.VISIBLE); View text1 = findViewById(R.id.text1); text1.setAlpha(0); text1.setVisibility(View.VISIBLE); View avatar2 = findViewById(R.id.avatar2); avatar2.setScaleX(0); avatar2.setScaleY(0); avatar2.setVisibility(View.VISIBLE); View text2 = findViewById(R.id.text2); text2.setAlpha(0); text2.setVisibility(View.VISIBLE); View avatar3 = findViewById(R.id.avatar3); avatar3.setScaleX(0); avatar3.setScaleY(0); avatar3.setVisibility(View.VISIBLE); View text3 = findViewById(R.id.text3); text3.setAlpha(0); text3.setVisibility(View.VISIBLE); View avatar4 = findViewById(R.id.avatar4); avatar4.setScaleX(0); avatar4.setScaleY(0); avatar4.setVisibility(View.VISIBLE); View text4 = findViewById(R.id.text4); text4.setAlpha(0); text4.setVisibility(View.VISIBLE); Interpolator interpolator = new FastOutSlowInInterpolator(); long duration = 375L; long delay = duration / 3; AnimatorSet anim1 = new AnimatorSet(); anim1.play(ObjectAnimator.ofFloat(avatar1, "scaleX", 1f)) .with(ObjectAnimator.ofFloat(avatar1, "scaleY", 1f)) .with(ObjectAnimator.ofFloat(text1, "alpha", 1f)); anim1.setDuration(duration); anim1.setInterpolator(interpolator); AnimatorSet anim2 = new AnimatorSet(); anim2.play(ObjectAnimator.ofFloat(avatar2, "scaleX", 1f)) .with(ObjectAnimator.ofFloat(avatar2, "scaleY", 1f)) .with(ObjectAnimator.ofFloat(text2, "alpha", 1f)); anim2.setDuration(duration); anim2.setInterpolator(interpolator); anim2.setStartDelay(delay); AnimatorSet anim3 = new AnimatorSet(); anim3.play(ObjectAnimator.ofFloat(avatar3, "scaleX", 1f)) .with(ObjectAnimator.ofFloat(avatar3, "scaleY", 1f)) .with(ObjectAnimator.ofFloat(text3, "alpha", 1f)); anim3.setDuration(duration); anim3.setInterpolator(interpolator); anim3.setStartDelay(delay * 2); AnimatorSet anim4 = new AnimatorSet(); anim4.play(ObjectAnimator.ofFloat(avatar4, "scaleX", 1f)) .with(ObjectAnimator.ofFloat(avatar4, "scaleY", 1f)) .with(ObjectAnimator.ofFloat(text4, "alpha", 1f)); anim4.setDuration(duration); anim4.setInterpolator(interpolator); anim4.setStartDelay(delay * 3); AnimatorSet set = new AnimatorSet(); set.play(anim1).with(anim2); set.play(anim2).with(anim3); set.play(anim3).with(anim4); set.start(); }
From source file:com.dalingge.gankio.common.widgets.recyclerview.anim.adapter.helper.ViewAnimator.java
/** * Animates given View.//from ww w . jav a2 s . c o m * * @param view the View that should be animated. */ private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) { if (mAnimationStartMillis == -1) { mAnimationStartMillis = SystemClock.uptimeMillis(); } ViewCompat.setAlpha(view, 0); AnimatorSet set = new AnimatorSet(); set.playTogether(animators); set.setStartDelay(calculateAnimationDelay(position)); set.setDuration(mAnimationDurationMillis); set.start(); mAnimators.put(view.hashCode(), set); }
From source file:com.devilyang.musicstation.swinginadapters.AnimationAdapter.java
private void animateView(int position, ViewGroup parent, View view) { if (mAnimationStartMillis == -1) { mAnimationStartMillis = System.currentTimeMillis(); }/*from w w w .ja va2 s . c om*/ // ViewDragHelper.setAlpha(view, 0); view.setAlpha(0); Animator[] childAnimators; if (mDecoratedBaseAdapter instanceof AnimationAdapter) { childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view); } else { childAnimators = new Animator[0]; } Animator[] animators = getAnimators(parent, view); Animator alphaAnimator = ObjectAnimator.ofFloat(view, "alpha", 0, 1); AnimatorSet set = new AnimatorSet(); set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator)); set.setStartDelay(calculateAnimationDelay()); set.setDuration(getAnimationDurationMillis()); set.start(); mAnimators.put(view.hashCode(), set); }
From source file:com.xianxiaotao.copyandstudy.xcopy.recycleranim.adapter.helper.ViewAnimator.java
/** * Animates given View.//from w ww . j av a 2s .co m * * @param view the View that should be animated. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) { if (mAnimationStartMillis == -1) { mAnimationStartMillis = SystemClock.uptimeMillis(); } ViewCompat.setAlpha(view, 0); AnimatorSet set = new AnimatorSet(); set.playTogether(animators); set.setStartDelay(calculateAnimationDelay(position)); set.setDuration(mAnimationDurationMillis); set.start(); mAnimators.put(view.hashCode(), set); }