List of usage examples for android.animation AnimatorSet AnimatorSet
public AnimatorSet()
From source file:org.videolan.vlc.gui.view.FastScroller.java
private void hideBubble() { currentAnimator = new AnimatorSet(); bubble.setPivotX(bubble.getWidth()); bubble.setPivotY(bubble.getHeight()); Animator shrinkerX = ObjectAnimator.ofFloat(bubble, SCALE_X, 1f, 0f).setDuration(HANDLE_ANIMATION_DURATION); Animator shrinkerY = ObjectAnimator.ofFloat(bubble, SCALE_Y, 1f, 0f).setDuration(HANDLE_ANIMATION_DURATION); Animator alpha = ObjectAnimator.ofFloat(bubble, ALPHA, 1f, 0f).setDuration(HANDLE_ANIMATION_DURATION); currentAnimator.playTogether(shrinkerX, shrinkerY, alpha); currentAnimator.addListener(new AnimatorListenerAdapter() { @Override//w ww . ja va 2s. c o m public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); bubble.setVisibility(GONE); currentAnimator = null; mHandler.sendEmptyMessageDelayed(HIDE_SCROLLER, SCROLLER_HIDE_DELAY); } @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); bubble.setVisibility(INVISIBLE); currentAnimator = null; mHandler.sendEmptyMessageDelayed(HIDE_SCROLLER, SCROLLER_HIDE_DELAY); } }); currentAnimator.start(); }
From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java
private void animateContent() { View avatar1 = findViewById(R.id.avatar1); avatar1.setScaleX(0);//www. j a va 2 s .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:io.vit.vitio.StartScreens.DetailFragment.java
public void animate() { ObjectAnimator animatorY = ObjectAnimator.ofFloat(displayImage, "translationY", 200, 0); ObjectAnimator animatorA = ObjectAnimator.ofFloat(displayImage, "alpha", 0, 1); animatorY.setDuration(200);/*from w ww .j a va 2 s. c om*/ animatorA.setDuration(200); animatorY.setInterpolator(new AccelerateInterpolator()); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animatorY, animatorA); animatorSet.start(); }
From source file:cn.edu.zucc.list.FabAnimation.MorphFabToDialog.java
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final TransitionValues endValues) { Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; }//from ww w. j ava 2s . co m 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); // ease in the dialog's child views (slide up & fade in) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; float offset = vg.getHeight() / 3; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.setTranslationY(offset); v.setAlpha(0f); v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator( AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in)) .start(); offset *= 1.8f; } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setDuration(300); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); return transition; }
From source file:com.liyu.huahui.ui.widgets.MorphDialogToFab.java
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override//ww w . j a 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// ww w . jav 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:org.amahi.anywhere.tv.fragment.IntroFragment.java
@Override protected Animator onCreateEnterAnimation() { ArrayList<Animator> animators = new ArrayList<>(); animators.add(createFadeInAnimator(mBackgroundView)); mContentView.setImageResource(CONTENT_IMAGES[0]); mContentAnimator = createFadeInAnimator(mContentView); animators.add(mContentAnimator);//w w w .ja v a 2s . c o m AnimatorSet set = new AnimatorSet(); set.playTogether(animators); mBackgroundView.setBackground(new ColorDrawable(mColors.get(0))); return set; }
From source file:com.example.linhdq.test.install.InstallActivity.java
private void startInstallAnimation() { mTip1.setAlpha(0);/*from w w w. j a v a 2s . co m*/ mTip2.setAlpha(0); mTip3.setAlpha(0); mYoutube.setAlpha(0); ObjectAnimator anim1 = ObjectAnimator.ofFloat(mTip1, "alpha", 1); ObjectAnimator anim2 = ObjectAnimator.ofFloat(mTip2, "alpha", 1); ObjectAnimator anim3 = ObjectAnimator.ofFloat(mTip3, "alpha", 1); ObjectAnimator anim4 = ObjectAnimator.ofFloat(mYoutube, "alpha", 1); AnimatorSet set = new AnimatorSet(); set.setStartDelay(300); set.setDuration(600); set.playTogether(anim1, anim2, anim3, anim4); set.start(); mFairyAnimation.start(); }
From source file:com.liyu.huahui.ui.widgets.MorphFabToDialog.java
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override//www .j a va2 s. c o m public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final 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); // ease in the dialog's child views (slide up & fade in) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; float offset = vg.getHeight() / 3; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.setTranslationY(offset); v.setAlpha(0f); v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator( AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in)) .start(); offset *= 1.8f; } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setDuration(300); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); return transition; }
From source file:com.sinyuk.jianyi.utils.morph.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//w w w . j a v a 2s. c o m public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final 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); // ease in the dialog's child views (slide up & fade in) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; float offset = vg.getHeight() / 3; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.setTranslationY(offset); v.setAlpha(0f); v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator( AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in)) .start(); offset *= 1.8f; } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setDuration(300); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); return transition; }