当前位置: 首页>>代码示例>>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;未经允许,请勿转载。