android.animation.AnimatorSet Java Examples

The following examples show how to use android.animation.AnimatorSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActionTeslaFragment.java    From rnd-android-wear-tesla with MIT License 6 votes vote down vote up
private void performActionAnimation(View view) {
    ValueAnimator startAnim = ValueAnimator.ofInt(mNormalImageSize, getSizeFromCoef(START_ANIMATION_OUT_SCALE_END));
    startAnim.addUpdateListener(new ScaleAnimateListener(view));
    startAnim.setDuration(START_ANIMATION_TIME);

    AnimatorSet middleAnim = new AnimatorSet();
    ValueAnimator middleOutScale = ValueAnimator.ofInt(getSizeFromCoef(MIDDLE_ANIMATION_OUT_SCALE_START), getSizeFromCoef(MIDDLE_ANIMATION_OUT_SCALE_END));
    middleOutScale.addUpdateListener(new ScaleAnimateListener(view));
    ValueAnimator middleInAlpha = ValueAnimator.ofFloat(MIDDLE_ANIMATION_IN_ALPHA_START, MIDDLE_ANIMATION_IN_ALPHA_END);
    middleInAlpha.addUpdateListener(new AlphaAnimateListener(view));
    middleAnim.playTogether(middleOutScale, middleInAlpha);
    middleAnim.setDuration(MIDDLE_ANIMATION_TIME);

    AnimatorSet endAnim = new AnimatorSet();
    ValueAnimator endInScale = ValueAnimator.ofInt(getSizeFromCoef(END_ANIMATION_IN_SCALE_START), getSizeFromCoef(END_ANIMATION_IN_SCALE_END));
    endInScale.addUpdateListener(new ScaleAnimateListener(view));
    ValueAnimator endInAlpha = ValueAnimator.ofFloat(END_ANIMATION_IN_ALPHA_START, END_ANIMATION_IN_ALPHA_END);
    endInAlpha.addUpdateListener(new AlphaAnimateListener(view));
    endAnim.playTogether(endInScale, endInAlpha);
    endAnim.setDuration(END_ANIMATION_TIME);

    AnimatorSet mainAnim = new AnimatorSet();
    mainAnim.playSequentially(startAnim, middleAnim, endAnim);
    mainAnim.setInterpolator(new LinearInterpolator());
    mainAnim.start();
}
 
Example #2
Source File: FlowAnimation.java    From flowless with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Animator createAnimation(@NonNull View previousView, @NonNull View newView, Direction direction) {
    if(direction == Direction.REPLACE) {
        return null;
    }
    boolean backward = direction == Direction.BACKWARD;
    int fromTranslation = backward ? previousView.getWidth() : -previousView.getWidth();
    int toTranslation = backward ? -newView.getWidth() : newView.getWidth();

    AnimatorSet set = new AnimatorSet();

    set.play(ObjectAnimator.ofFloat(previousView, View.TRANSLATION_X, fromTranslation));
    set.play(ObjectAnimator.ofFloat(newView, View.TRANSLATION_X, toTranslation, 0));

    return set;
}
 
Example #3
Source File: ChatActivityEnterView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideRecordedAudioPanel()
{
    audioToSendPath = null;
    audioToSend = null;
    audioToSendMessageObject = null;
    videoToSendMessageObject = null;
    videoTimelineView.destroy();
    AnimatorSet AnimatorSet = new AnimatorSet();
    AnimatorSet.playTogether(
            ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
    );
    AnimatorSet.setDuration(200);
    AnimatorSet.addListener(new AnimatorListenerAdapter()
    {
        @Override
        public void onAnimationEnd(Animator animation)
        {
            recordedAudioPanel.setVisibility(GONE);

        }
    });
    AnimatorSet.start();
}
 
Example #4
Source File: OperationLayout.java    From AlbumCameraRecorder with MIT License 6 votes vote down vote up
/**
 * 拍点击长按结果后的动画 - 多图片
 */
public void startOperaeBtnAnimatorMulti() {
    // 如果本身隐藏的,就显示出来
    if (mViewHolder.btnConfirm.getVisibility() == View.GONE) {
        // 显示提交按钮
        mViewHolder.btnConfirm.setVisibility(VISIBLE);
        // 动画未结束前不能让它们点击
        mViewHolder.btnConfirm.setClickable(false);

        // 显示动画
        ObjectAnimator animatorConfirm = ObjectAnimator.ofFloat(mViewHolder.btnConfirm, "translationX", -mLayoutWidth / 4, 0);
        AnimatorSet set = new AnimatorSet();
        set.playTogether(animatorConfirm);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                // 动画结束使得按钮可点击
                mViewHolder.btnConfirm.setClickable(true);
            }
        });
        set.setDuration(200);
        set.start();
    }
}
 
Example #5
Source File: MiuiKeyguardVerticalClockHook.java    From XMiTools with GNU General Public License v3.0 6 votes vote down vote up
private void hookClearAnim() {
    findAndHookMethod(mMiuiKeyguardVerticalClockCls,
            "clearAnim",
            new MethodHookWrapper() {
                @Override
                protected void after(MethodHookParam param) {
                    Object keyguardClock = param.thisObject;
                    AnimatorSet mHorizontalToVerticalAnim2 = (AnimatorSet) getAdditionalInstanceField(keyguardClock, M_HORIZONTAL_TO_VERTICAL_ANIM_2);
                    if (mHorizontalToVerticalAnim2 != null) {
                        mHorizontalToVerticalAnim2.cancel();
                    }

                    AnimatorSet mVerticalToHorizontalAnim2 = (AnimatorSet) getAdditionalInstanceField(keyguardClock, M_VERTICAL_TO_HORIZONTAL_ANIM_2);
                    if (mVerticalToHorizontalAnim2 != null) {
                        mVerticalToHorizontalAnim2.cancel();
                    }

                    TextView mVerticalSec = (TextView) getAdditionalInstanceField(keyguardClock, M_VERTICAL_SEC);
                    if (mVerticalSec != null) {
                        mVerticalSec.clearAnimation();
                    }
                }
            });
}
 
Example #6
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingButton(boolean hide)
{
    if (floatingHidden == hide)
    {
        return;
    }
    floatingHidden = hide;
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(floatingButton, "translationY", floatingHidden ?
                    AndroidUtilities.dp(!FeaturedSettings.tabSettings.hideTabs && FeaturedSettings.tabSettings.tabsToBottom ? 150 : 100) : 0),
            ObjectAnimator.ofFloat(unreadFloatingButtonContainer, "translationY", floatingHidden ? AndroidUtilities.dp(74) : 0));
    animatorSet.setDuration(300);
    animatorSet.setInterpolator(floatingInterpolator);
    floatingButton.setClickable(!hide);
    animatorSet.start();
}
 
Example #7
Source File: FadeInAnimation.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public AnimatorSet getAnimatorSet() {
	view.setAlpha(0f);
	view.setVisibility(View.VISIBLE);

	AnimatorSet fadeSet = new AnimatorSet();
	fadeSet.play(ObjectAnimator.ofFloat(view, View.ALPHA, 1f));
	fadeSet.setInterpolator(interpolator);
	fadeSet.setDuration(duration);
	fadeSet.addListener(new AnimatorListenerAdapter() {

		@Override
		public void onAnimationEnd(Animator animation) {
			if (getListener() != null) {
				getListener().onAnimationEnd(FadeInAnimation.this);
			}
		}
	});
	return fadeSet;
}
 
Example #8
Source File: RocketAvatarsAnimator.java    From welcome-coordinator with Apache License 2.0 6 votes vote down vote up
private void initializeAnimator() {
    final View rocketFlame = rootView.findViewById(R.id.rocket_flame);
    final View avatar1 = rootView.findViewById(R.id.avatar1);
    final View avatar2 = rootView.findViewById(R.id.avatar2);
    final View avatar3 = rootView.findViewById(R.id.avatar3);
    final View avatar4 = rootView.findViewById(R.id.avatar4);
    Animator avatar1Animator = getAnimator(avatar1);
    Animator avatar2Animator = getAnimator(avatar2);
    Animator avatar3Animator = getAnimator(avatar3);
    Animator avatar4Animator = getAnimator(avatar4);
    rocketFlameAnimator = getFlameAnimator(rocketFlame);
    animator = new AnimatorSet();
    animator.setStartDelay(500);
    animator.play(avatar3Animator).after(avatar4Animator);
    animator.play(avatar2Animator).after(avatar3Animator);
    animator.play(avatar1Animator).after(avatar2Animator);
}
 
Example #9
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingDateView(boolean animated) {
    if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
        floatingDateView.setTag(null);
        if (animated) {
            floatingDateAnimation = new AnimatorSet();
            floatingDateAnimation.setDuration(150);
            floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
            floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (animation.equals(floatingDateAnimation)) {
                        floatingDateAnimation = null;
                    }
                }
            });
            floatingDateAnimation.setStartDelay(500);
            floatingDateAnimation.start();
        } else {
            if (floatingDateAnimation != null) {
                floatingDateAnimation.cancel();
                floatingDateAnimation = null;
            }
            floatingDateView.setAlpha(0.0f);
        }
    }
}
 
Example #10
Source File: InSyncAnimator.java    From welcome-coordinator with Apache License 2.0 6 votes vote down vote up
private void initializeAnimator() {
    final View avatarView = rootView.findViewById(R.id.avatar5);
    final View arrowChartMaskView = rootView.findViewById(R.id.arrow_chart_mask);
    final ObjectAnimator scaleXAnimator = ObjectAnimator
            .ofFloat(avatarView, View.SCALE_X, 0f, 1f);
    scaleXAnimator.setDuration(300);
    scaleXAnimator.setInterpolator(new OvershootInterpolator());
    final ObjectAnimator scaleYAnimator = ObjectAnimator
            .ofFloat(avatarView, View.SCALE_Y, 0f, 1f);
    scaleYAnimator.setDuration(300);
    scaleYAnimator.setInterpolator(new OvershootInterpolator());
    final ObjectAnimator maskScaleXAnimator = ObjectAnimator
            .ofFloat(arrowChartMaskView, View.SCALE_X, 1f, 0f);
    maskScaleXAnimator.setDuration(500);
    maskScaleXAnimator.setInterpolator(new LinearInterpolator());
    animator = new AnimatorSet();
    animator.play(scaleXAnimator).with(scaleYAnimator).before(maskScaleXAnimator);
}
 
Example #11
Source File: DefaultLayoutAnimator.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
protected AnimatorSet getItemsAddedAnimation(List<FreeFlowItem> added) {
    AnimatorSet appearingSet = new AnimatorSet();
    ArrayList<Animator> fadeIns = new ArrayList<Animator>();
    for (FreeFlowItem proxy : added) {
        proxy.view.setAlpha(0);
        fadeIns.add(ObjectAnimator.ofFloat(proxy.view, "alpha", 1));
    }

    if (animateIndividualCellsSequentially)
        appearingSet.playSequentially(fadeIns);
    else
        appearingSet.playTogether(fadeIns);

    appearingSet.setStartDelay(newCellsAdditionAnimationStartDelay);
    appearingSet.setDuration(newCellsAdditionAnimationDurationPerCell);
    return appearingSet;
}
 
Example #12
Source File: SampleItemAnimator.java    From FlyRefresh with MIT License 6 votes vote down vote up
@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    View target = holder.itemView;
    View icon = target.findViewById(R.id.icon);
    Animator swing = ObjectAnimator.ofFloat(icon, "rotationX", 45, 0);
    swing.setInterpolator(new OvershootInterpolator(5));

    View right = holder.itemView.findViewById(R.id.right);
    Animator rotateIn = ObjectAnimator.ofFloat(right, "rotationY", 90, 0);
    rotateIn.setInterpolator(new DecelerateInterpolator());

    AnimatorSet animator = new AnimatorSet();
    animator.setDuration(getAddDuration());
    animator.playTogether(swing, rotateIn);

    animator.start();
}
 
Example #13
Source File: MainActivity.java    From Flubber with Apache License 2.0 6 votes vote down vote up
private AnimatorSet getHideWithReveal(final View toHide) {
    final AnimatorSet animatorSet = new AnimatorSet();

    binding.revealView.setVisibility(View.VISIBLE);

    final Animator revealAnimation =
            Flubber.with()
                    .animation(RevealProvider.create(binding.floatingActionButton, binding.revealView, false))
                    .duration(DURATION_REVEAL)
                    .createFor(toHide);

    final Animator fadeOut =
            Flubber.with()
                    .animation(Flubber.AnimationPreset.FADE_IN)
                    .interpolator(Flubber.Curve.BZR_EASE_OUT)
                    .duration(DURATION_FADE)
                    .listener(SimpleAnimatorListener.forEnd(animation -> toHide.setVisibility(View.INVISIBLE)))
                    .createFor(binding.revealView);

    animatorSet.play(revealAnimation).after(fadeOut);

    return animatorSet;
}
 
Example #14
Source File: ShutterButton.java    From KrGallery with GNU General Public License v2.0 6 votes vote down vote up
private void setHighlighted(boolean value) {
    AnimatorSet animatorSet = new AnimatorSet();
    if (value) {
        animatorSet.playTogether(
                ObjectAnimator.ofFloat(this, "scaleX", 1.06f),
                ObjectAnimator.ofFloat(this, "scaleY", 1.06f));
    } else {
        animatorSet.playTogether(
                ObjectAnimator.ofFloat(this, "scaleX", 1.0f),
                ObjectAnimator.ofFloat(this, "scaleY", 1.0f));
        animatorSet.setStartDelay(40);
    }
    animatorSet.setDuration(120);
    animatorSet.setInterpolator(interpolator);
    animatorSet.start();
}
 
Example #15
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
public void setObj(View view) {
	// ��ȡ��Ļ�Ŀ��
	DisplayMetrics metri = getResources().getDisplayMetrics();
	// ����������Ϊ��λ
	int width = metri.widthPixels;
	// ���ߣ�������Ϊ��λ
	int height = metri.heightPixels;
	// 2.����x,y��������Զ���
	ObjectAnimator objTranY = ObjectAnimator.ofFloat(ib, "TranslationY", 0,
			height - 2 * ib.getHeight());
	ObjectAnimator objTranX = ObjectAnimator.ofFloat(ib, "TranslationX", 0,
			width - ib.getWidth());
	// 3.����AnimatorSet
	AnimatorSet set = new AnimatorSet();
	
	set.setDuration(3000);
	// 4.ͨ��AnimatorSet.play��Ӳ����ò���ģʽ
	set.playTogether(objTranX, objTranY);
	// 5.����
	set.start();

}
 
Example #16
Source File: ChannelAdminLogActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingDateView(boolean animated) {
    if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
        floatingDateView.setTag(null);
        if (animated) {
            floatingDateAnimation = new AnimatorSet();
            floatingDateAnimation.setDuration(150);
            floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
            floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (animation.equals(floatingDateAnimation)) {
                        floatingDateAnimation = null;
                    }
                }
            });
            floatingDateAnimation.setStartDelay(500);
            floatingDateAnimation.start();
        } else {
            if (floatingDateAnimation != null) {
                floatingDateAnimation.cancel();
                floatingDateAnimation = null;
            }
            floatingDateView.setAlpha(0.0f);
        }
    }
}
 
Example #17
Source File: CellLayout.java    From TurboLauncher with Apache License 2.0 6 votes vote down vote up
private void completeAnimationImmediately() {
    if (a != null) {
        a.cancel();
    }

    AnimatorSet s = LauncherAnimUtils.createAnimatorSet();
    a = s;
    s.playTogether(
        LauncherAnimUtils.ofFloat(child, "scaleX", getChildrenScale()),
        LauncherAnimUtils.ofFloat(child, "scaleY", getChildrenScale()),
        LauncherAnimUtils.ofFloat(child, "translationX", 0f),
        LauncherAnimUtils.ofFloat(child, "translationY", 0f)
    );
    s.setDuration(REORDER_ANIMATION_DURATION);
    s.setInterpolator(new android.view.animation.DecelerateInterpolator(1.5f));
    s.start();
}
 
Example #18
Source File: MainGameActivity.java    From ColorPhun with Apache License 2.0 6 votes vote down vote up
protected void setupProgressView() {
    timerProgress = (ProgressBar) findViewById(R.id.progress_bar);
    pointsTextView = (TextView) findViewById(R.id.points_value);
    levelTextView = (TextView) findViewById(R.id.level_value);
    TextView pointsLabel = (TextView) findViewById(R.id.points_label);
    TextView levelsLabel = (TextView) findViewById(R.id.level_label);

    // setting up fonts
    Typeface avenir_black = Typeface.createFromAsset(getAssets(), "fonts/avenir_black.ttf");
    Typeface avenir_book = Typeface.createFromAsset(getAssets(), "fonts/avenir_book.ttf");
    pointsTextView.setTypeface(avenir_black);
    levelTextView.setTypeface(avenir_black);
    pointsLabel.setTypeface(avenir_book);
    levelsLabel.setTypeface(avenir_book);

    // setting up animations
    pointAnim = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.points_animations);
    pointAnim.setTarget(pointsTextView);
    levelAnim = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.level_animations);
    levelAnim.setTarget(levelTextView);
}
 
Example #19
Source File: SnackbarView.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
void dismiss() {
    // Disable action button during animation.
    mActionButtonView.setEnabled(false);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(mAnimationDuration);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mParent.removeOnLayoutChangeListener(mLayoutListener);
            mParent.removeView(mView);
        }
    });
    Animator moveDown = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y,
            mView.getHeight() + getLayoutParams().bottomMargin);
    moveDown.setInterpolator(new DecelerateInterpolator());
    Animator fadeOut = ObjectAnimator.ofFloat(mView, View.ALPHA, 0f);
    fadeOut.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);

    animatorSet.playTogether(fadeOut, moveDown);
    startAnimatorOnSurfaceView(animatorSet);
}
 
Example #20
Source File: AnimatorSetFragment.java    From AndroidAll with Apache License 2.0 6 votes vote down vote up
private void startByBuilder() {
    ObjectAnimator objectAnimatorA = ObjectAnimator.ofFloat(viewTargetA,
            "translationY", 0, 300, 0);
    ObjectAnimator colorAnimatorA = ObjectAnimator.ofInt(viewTargetA,
            "backgroundColor", 0xffffffff, 0xffff00ff, 0xffffff00);

    ObjectAnimator objectAnimatorB = ObjectAnimator.ofFloat(viewTargetB,
            "translationY", 0, 300, 0);

    //===============================================================
    //先同时执行objectAnimator1和colorAnimator,完毕后再执行objectAnimator2
    //builder方法解释:
    //with(animator) 和前面的动画一起执行
    //before(animator) 前面的动画在参数animator动画执行之前执行
    //after(animator) 前面的动画在参数animator动画执行完之执行
    //如何理解 :  方法名(参数),从右往左读. 重点是参数,前面的动画到底是在参数之前还是之后执行 通过方法名就知道了.
    //===============================================================

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(objectAnimatorA)
            .with(colorAnimatorA)
            .before(objectAnimatorB);

    animatorSet.setDuration(1000);
    animatorSet.start();
}
 
Example #21
Source File: AnimatorSetFragment.java    From AndroidAll with Apache License 2.0 6 votes vote down vote up
private void doAnimateOpen(View view, int index, int total, int radius) {
    if (view.getVisibility() != View.VISIBLE) {
        view.setVisibility(View.VISIBLE);
    }
    double degree = Math.toRadians(90) / (total - 1) * index;
    int translationX = -(int) (radius * Math.sin(degree));
    int translationY = -(int) (radius * Math.cos(degree));

    AnimatorSet set = new AnimatorSet();
    //包含平移、缩放和透明度动画
    set.playTogether(
            ObjectAnimator.ofFloat(view, "translationX", 0, translationX),
            ObjectAnimator.ofFloat(view, "translationY", 0, translationY),
            ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f),
            ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f),
            ObjectAnimator.ofFloat(view, "alpha", 0f, 1));
    //动画周期为500ms
    set.setDuration(300).start();
}
 
Example #22
Source File: ZoomInAnimator.java    From PowerfulRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected AnimatorSet generateRemoveAnimator(RecyclerView.ViewHolder holder) {
    View target = holder.itemView;

    AnimatorSet animator = new AnimatorSet();

    animator.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", 1.0f, 0.0f),
            ObjectAnimator.ofFloat(target, "scaleY", 1.0f, 0.0f)
    );

    animator.setTarget(target);
    animator.setDuration(getRemoveDuration());

    return animator;
}
 
Example #23
Source File: AccessibilityTabModelListItem.java    From delion with Apache License 2.0 6 votes vote down vote up
private void runBlinkOutAnimation() {
    cancelRunningAnimation();
    mSwipedAway = 0;

    ObjectAnimator stretchX = ObjectAnimator.ofFloat(this, View.SCALE_X, 1.2f);
    ObjectAnimator shrinkY = ObjectAnimator.ofFloat(this, View.SCALE_Y, 0.f);
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0.f);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(fadeOut, shrinkY, stretchX);
    set.addListener(mCloseAnimatorListener);
    set.setDuration(mCloseAnimationDurationMs);
    set.start();

    mActiveAnimation = set;
}
 
Example #24
Source File: CapturePhotoFragment.java    From MediaPickerInstagram with Apache License 2.0 6 votes vote down vote up
private void animateShutter() {
    mShutter.setVisibility(View.VISIBLE);
    mShutter.setAlpha(0.f);

    ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(mShutter, "alpha", 0f, 0.8f);
    alphaInAnim.setDuration(100);
    alphaInAnim.setStartDelay(100);
    alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR);

    ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(mShutter, "alpha", 0.8f, 0f);
    alphaOutAnim.setDuration(200);
    alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playSequentially(alphaInAnim, alphaOutAnim);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mShutter.setVisibility(View.GONE);
        }
    });
    animatorSet.start();
}
 
Example #25
Source File: CaptureActivity.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
public void stopButtonAnimation() {
    AnimatorSet animatorSet = new AnimatorSet();//组合动画
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(capturebg, "scaleX", 1.4f, 1f);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(capturebg, "scaleY", 1.4f, 1f);
    //        mProgressView.setVisibility(View.INVISIBLE);
    capturebg.setVisibility(View.VISIBLE);
    animatorSet.setDuration(100);
    animatorSet.setInterpolator(new LinearInterpolator());
    animatorSet.play(scaleX).with(scaleY);//两个动画同时开始
    animatorSet.start();
    cameraTip.setVisibility(View.VISIBLE);
}
 
Example #26
Source File: Spruce.java    From spruce-android with MIT License 5 votes vote down vote up
private AnimatorSet getAnimatorSetForSort(Animator[] animators, SortFunction sortFunction) {
    List<SpruceTimedView> childrenWithTime;
    List<View> children = new ArrayList<>();

    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        children.add(viewGroup.getChildAt(i));
    }

    sortFunction.sortChildren(viewGroup, children);
    childrenWithTime = sortFunction.getViewListWithTimeOffsets(viewGroup, children);
    animatorSet = new AnimatorSet();
    List<Animator> animatorsList = new ArrayList<>();

    for (SpruceTimedView childView : childrenWithTime) {
        for (Animator animatorChild : animators) {
            Animator animatorCopy = animatorChild.clone();
            animatorCopy.setTarget(childView.getView());
            animatorCopy.start();
            animatorCopy.cancel();
            animatorCopy.setDuration((childView.getTimeOffset()+animatorChild.getDuration()));
            animatorsList.add(animatorCopy);
        }
    }
    animatorSet.playTogether(animatorsList);

    return animatorSet;
}
 
Example #27
Source File: ContactsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void hideFloatingButton(boolean hide) {
    if (floatingHidden == hide) {
        return;
    }
    floatingHidden = hide;
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(floatingButtonContainer, View.TRANSLATION_Y,  (floatingHidden ? AndroidUtilities.dp(100) : 0)));
    animatorSet.setDuration(300);
    animatorSet.setInterpolator(floatingInterpolator);
    floatingButtonContainer.setClickable(!hide);
    animatorSet.start();
}
 
Example #28
Source File: Actions.java    From AndroidAnimationsActions with MIT License 5 votes vote down vote up
/**
 * Runs actions sequence
 *
 * @param animators actions to run
 */
@NonNull
public static Animator sequence(@NonNull Animator... animators) {
    AnimatorSet set = new AnimatorSet();
    set.playSequentially(animators);
    return set;
}
 
Example #29
Source File: Flip.java    From android-animations with MIT License 5 votes vote down vote up
public static AnimatorSet InX(View view) {
    AnimatorSet animatorSet = new AnimatorSet();

    ObjectAnimator object1 = ObjectAnimator.ofFloat(view,  "alpha", 0.25f, 0.5f, 0.75f, 1);
    ObjectAnimator object2 = ObjectAnimator.ofFloat(view,  "rotationX", 90, -15, 15, 0);

    animatorSet.playTogether(object1, object2);
    return animatorSet;
}
 
Example #30
Source File: FlatPlayerFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void animateColorChange(int newColor) {
    super.animateColorChange(newColor);

    AnimatorSet animatorSet = createDefaultColorChangeAnimatorSet(newColor);
    animatorSet.play(ViewUtil.createBackgroundColorTransition(fragment.toolbar, fragment.lastColor, newColor));
    animatorSet.start();
}