當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimatorSet類代碼示例

本文整理匯總了Java中android.animation.AnimatorSet的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorSet類的具體用法?Java AnimatorSet怎麽用?Java AnimatorSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnimatorSet類屬於android.animation包,在下文中一共展示了AnimatorSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openDrawer

import android.animation.AnimatorSet; //導入依賴的package包/類
public void openDrawer(boolean fast) {
    if (!allowOpenDrawer) {
        return;
    }
    if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) {
        AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus());
    }
    cancelCurrentAnimation();
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(this, "drawerPosition", drawerLayout.getMeasuredWidth()));
    animatorSet.setInterpolator(new DecelerateInterpolator());
    if (fast) {
        animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * (drawerLayout.getMeasuredWidth() - drawerPosition)), 50));
    } else {
        animatorSet.setDuration(300);
    }
    animatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animator) {
            onDrawerAnimationEnd(true);
        }
    });
    animatorSet.start();
    currentAnimation = animatorSet;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:26,代碼來源:DrawerLayoutContainer.java

示例2: CircularAnimatedDrawable

import android.animation.AnimatorSet; //導入依賴的package包/類
/**
 * @param view        View to be animated
 * @param borderWidth The width of the spinning bar
 * @param arcColor    The color of the spinning bar
 */
public CircularAnimatedDrawable(View view, float borderWidth, int arcColor, @DrawableRes int innerResource, @ColorInt int innerResourceColorFilter) {
    mAnimatedView = view;
    mBorderWidth = borderWidth;

    if (innerResource != 0) {
        setInnerResource(innerResource);
        setInnerResourceColorFilter(innerResourceColorFilter);
    }

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(borderWidth);
    mPaint.setColor(arcColor);

    setupAnimations();

    shouldDraw = true;

    mAnimatorSet = new AnimatorSet();
}
 
開發者ID:JMaroz,項目名稱:RoundButton,代碼行數:27,代碼來源:CircularAnimatedDrawable.java

示例3: onCreate

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    user = (ClearEditText) findViewById(R.id.user);
    user.addTextChangedListener(userTextWatcher);
    user.setOnFocusChangeListener(this);

    pass = (ClearEditText) findViewById(R.id.pass);
    pass.setOnFocusChangeListener(this);
    pass.addTextChangedListener(passTextWatcher);

    login = (Button) findViewById(R.id.login);
    login.setOnClickListener(this);
    register = (Button) findViewById(R.id.register);
    register.setOnClickListener(this);
    forget = (TextView) findViewById(R.id.forget);

    ObjectAnimator animator = ObjectAnimator.ofFloat(forget, "rotation", 0, 360f);
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(forget, "alpha", 1f, 0f, 1f);
    AnimatorSet set = new AnimatorSet();
    set.play(animator).with(animator1);
    set.setDuration(5000);
    set.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:MainActivity.java

示例4: prepareStateChange

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
    int finalAlpha = getAlphaForState(toState);
    if (targetAnim == null) {
        mBgPaint.setAlpha(finalAlpha);
        invalidate();
    } else {
        ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
        anim.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                invalidate();
            }
        });
        targetAnim.play(anim);
    }
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:18,代碼來源:QsbBlockerView.java

示例5: createDismissAnimator

import android.animation.AnimatorSet; //導入依賴的package包/類
public Animator createDismissAnimator(final View target) {
    if (mHasCustomAnimationParams) {
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_X, mDismissEndXScale);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_Y, mDismissEndYScale);
        final AnimatorSet dismissAnimator = new AnimatorSet();
        dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
        final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
        dismissAnimator.setDuration(dismissDuration);
        dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
        return dismissAnimator;
    }
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mDismissAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(ACCELERATE_INTERPOLATOR);
    return animator;
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:20,代碼來源:KeyPreviewDrawParams.java

示例6: prepare

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
    ViewGroup parent = (ViewGroup) target.getParent();
    int distance = parent.getHeight() - target.getTop();
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 0, 1),
            ObjectAnimator.ofFloat(target, "translationY", distance, 0)
    );
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:10,代碼來源:SlideInUpAnimatorDecoration.java

示例7: hideRecordedAudioPanel

import android.animation.AnimatorSet; //導入依賴的package包/類
private void hideRecordedAudioPanel() {
    audioToSendPath = null;
    audioToSend = null;
    audioToSendMessageObject = null;
    AnimatorSet AnimatorSet = new AnimatorSet();
    AnimatorSet.playTogether(
            ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
    );
    AnimatorSet.setDuration(200);
    AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animation) {
            recordedAudioPanel.setVisibility(GONE);

        }
    });
    AnimatorSet.start();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:19,代碼來源:ChatActivityEnterView.java

示例8: getAnimationToState

import android.animation.AnimatorSet; //導入依賴的package包/類
public AnimatorSet getAnimationToState(Workspace.State fromState, Workspace.State toState,
        boolean animated, HashMap<View, Integer> layerViews) {
    AccessibilityManager am = (AccessibilityManager)
            mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
    final boolean accessibilityEnabled = am.isEnabled();
    TransitionStates states = new TransitionStates(fromState, toState);
    int workspaceDuration = getAnimationDuration(states);
    animateWorkspace(states, animated, workspaceDuration, layerViews,
            accessibilityEnabled);
    animateBackgroundGradient(states, animated, BACKGROUND_FADE_OUT_DURATION);
    return mStateAnimator;
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:13,代碼來源:WorkspaceStateTransitionAnimation.java

示例9: animateSunblind

import android.animation.AnimatorSet; //導入依賴的package包/類
public static void animateSunblind(RecyclerView.ViewHolder holder, boolean goesDown) {
    int holderHeight = holder.itemView.getHeight();
    holder.itemView.setPivotY(goesDown == true ? 0 : holderHeight);
    holder.itemView.setPivotX(holder.itemView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0);
    ObjectAnimator animatorRotation = ObjectAnimator.ofFloat(holder.itemView, "rotationX", goesDown == true ? -90f : 90, 0f);
    ObjectAnimator animatorScaleX = ObjectAnimator.ofFloat(holder.itemView, "scaleX", 0.5f, 1f);
    animatorSet.playTogether(animatorTranslateY, animatorRotation, animatorScaleX);
    animatorSet.setInterpolator(new DecelerateInterpolator(1.1f));
    animatorSet.setDuration(1000);
    animatorSet.start();
}
 
開發者ID:vikasdesale,項目名稱:Wings2K16,代碼行數:14,代碼來源:AnimationUtils.java

示例10: createAnimator

import android.animation.AnimatorSet; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
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;
}
 
開發者ID:li-yu,項目名稱:Huahui-Android,代碼行數:41,代碼來源:MorphDialogToFab.java

示例11: startAnimation

import android.animation.AnimatorSet; //導入依賴的package包/類
private void startAnimation() {
    float sunYStart = mSunView.getTop();
    float sunYEnd = mSkyView.getHeight();

    ObjectAnimator heightAnimator = ObjectAnimator
            .ofFloat(mSunView, "y", sunYStart, sunYEnd)
            .setDuration(3000);
    heightAnimator.setInterpolator(new AccelerateInterpolator());

    ObjectAnimator sunsetSkyAnimator = ObjectAnimator
            .ofInt(mSkyView, "backgroundColor", mBlueSkyColor, mSunsetSkyColor)
            .setDuration(3000);
    sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());

    ObjectAnimator nightSkyAnimator = ObjectAnimator
            .ofInt(mSkyView, "backgroundColor", mSunsetSkyColor, mNightSkyColor)
            .setDuration(1500);
    nightSkyAnimator.setEvaluator(new ArgbEvaluator());

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet
            .play(heightAnimator)
            .with(sunsetSkyAnimator)
            .before(nightSkyAnimator);
    animatorSet.start();
}
 
開發者ID:rsippl,項目名稱:AndroidProgramming3e,代碼行數:27,代碼來源:SunsetFragment.java

示例12: createOpenAnimation

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
public Animator createOpenAnimation(boolean isContainerAboveIcon, boolean pivotLeft) {
    AnimatorSet openAnimation = LauncherAnimUtils.createAnimatorSet();
    openAnimation.play(super.createOpenAnimation(isContainerAboveIcon, pivotLeft));
    for (int i = 0; i < mShortcutsLayout.getChildCount(); i++) {
        if (!(mShortcutsLayout.getChildAt(i) instanceof DeepShortcutView)) {
            continue;
        }
        DeepShortcutView shortcutView = ((DeepShortcutView) mShortcutsLayout.getChildAt(i));
        View deepShortcutIcon = shortcutView.getIconView();
        deepShortcutIcon.setScaleX(0);
        deepShortcutIcon.setScaleY(0);
        openAnimation.play(LauncherAnimUtils.ofPropertyValuesHolder(
                deepShortcutIcon, new PropertyListBuilder().scale(1).build()));
    }
    return openAnimation;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:18,代碼來源:ShortcutsItemView.java

示例13: createCloseAnimation

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
public Animator createCloseAnimation(boolean isContainerAboveIcon, boolean pivotLeft,
        long duration) {
    AnimatorSet closeAnimation = LauncherAnimUtils.createAnimatorSet();
    closeAnimation.play(super.createCloseAnimation(isContainerAboveIcon, pivotLeft, duration));
    for (int i = 0; i < mShortcutsLayout.getChildCount(); i++) {
        if (!(mShortcutsLayout.getChildAt(i) instanceof DeepShortcutView)) {
            continue;
        }
        DeepShortcutView shortcutView = ((DeepShortcutView) mShortcutsLayout.getChildAt(i));
        View deepShortcutIcon = shortcutView.getIconView();
        deepShortcutIcon.setScaleX(1);
        deepShortcutIcon.setScaleY(1);
        closeAnimation.play(LauncherAnimUtils.ofPropertyValuesHolder(
                deepShortcutIcon, new PropertyListBuilder().scale(0).build()));
    }
    return closeAnimation;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:19,代碼來源:ShortcutsItemView.java

示例14: prepare

import android.animation.AnimatorSet; //導入依賴的package包/類
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", 0.45f, 1),
            ObjectAnimator.ofFloat(target, "scaleY", 0.45f, 1),
            ObjectAnimator.ofFloat(target, "alpha", 0, 1)
    );
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:9,代碼來源:ZoomInAnimatorDecoration.java

示例15: hideToolbar

import android.animation.AnimatorSet; //導入依賴的package包/類
/**
 * Function to hide tool bar
 */
public void hideToolbar() {

    ObjectAnimator toolbarAnimY = ObjectAnimator.ofFloat(myToolbarContainer, "y", -(myToolbarContainer.getHeight()));
    AnimatorSet toolbarHideAnimation = new AnimatorSet();
    toolbarHideAnimation.setInterpolator(new LinearInterpolator());
    toolbarHideAnimation.play(toolbarAnimY);
    toolbarHideAnimation.start();
}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:12,代碼來源:QuranPageReadActivity.java


注:本文中的android.animation.AnimatorSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。