当前位置: 首页>>代码示例>>Java>>正文


Java ObjectAnimator类代码示例

本文整理汇总了Java中android.animation.ObjectAnimator的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator类的具体用法?Java ObjectAnimator怎么用?Java ObjectAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectAnimator类属于android.animation包,在下文中一共展示了ObjectAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyBadgeState

import android.animation.ObjectAnimator; //导入依赖的package包/类
public void applyBadgeState(ItemInfo itemInfo, boolean animate) {
    if (mIcon instanceof FastBitmapDrawable) {
        boolean wasBadged = mBadgeInfo != null;
        mBadgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
        boolean isBadged = mBadgeInfo != null;
        float newBadgeScale = isBadged ? 1f : 0;
        mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
        if (wasBadged || isBadged) {
            mBadgePalette = ((FastBitmapDrawable) mIcon).getIconPalette();
            // Animate when a badge is first added or when it is removed.
            if (animate && (wasBadged ^ isBadged) && isShown()) {
                ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start();
            } else {
                mBadgeScale = newBadgeScale;
                invalidate();
            }
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:20,代码来源:BubbleTextView.java

示例2: closeDrawer

import android.animation.ObjectAnimator; //导入依赖的package包/类
public void closeDrawer(boolean fast) {
    cancelCurrentAnimation();
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(this, "drawerPosition", 0)
    );
    animatorSet.setInterpolator(new DecelerateInterpolator());
    if (fast) {
        animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * drawerPosition), 50));
    } else {
        animatorSet.setDuration(300);
    }
    animatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animator) {
            onDrawerAnimationEnd(false);
        }
    });
    animatorSet.start();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:21,代码来源:DrawerLayoutContainer.java

示例3: createShowItemAnimator

import android.animation.ObjectAnimator; //导入依赖的package包/类
private Animator createShowItemAnimator(View item) {
  float dx = centerItem.getX() - item.getX();
  float dy = centerItem.getY() - item.getY();

  item.setScaleX(0f);
  item.setScaleY(0f);
  item.setTranslationX(dx);
  item.setTranslationY(dy);

  Animator anim = ObjectAnimator.ofPropertyValuesHolder(
      item,
      AnimatorUtils.scaleX(0f, 1f),
      AnimatorUtils.scaleY(0f, 1f),
      AnimatorUtils.translationX(dx, 0f),
      AnimatorUtils.translationY(dy, 0f)
  );

  anim.setInterpolator(new DecelerateInterpolator());
  anim.setDuration(50);
  return anim;
}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:22,代码来源:DemoLikeTumblrActivity.java

示例4: testAnim

import android.animation.ObjectAnimator; //导入依赖的package包/类
@NonNull
    private AnimatorSet testAnim(GiftFrameLayout giftFrameLayout) {
        PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0, -50);
        PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.5f);
        ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator.setStartDelay(0);
        animator.setDuration(1500);

        translationY = PropertyValuesHolder.ofFloat("translationY", -50, -100);
        alpha = PropertyValuesHolder.ofFloat("alpha", 0.5f, 0f);
        ObjectAnimator animator1 = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator1.setStartDelay(0);
        animator1.setDuration(1500);

        // 复原
//        ObjectAnimator fadeAnimator2 = GiftAnimationUtil.createFadeAnimator(giftFrameLayout, 0, 0, 0, 0);

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(animator1).after(animator);
//        animatorSet.play(fadeAnimator2).after(animator1);
        animatorSet.start();
        return animatorSet;
    }
 
开发者ID:DyncKathline,项目名称:LiveGiftLayout,代码行数:24,代码来源:CustormAnim.java

示例5: targetViewAnim

import android.animation.ObjectAnimator; //导入依赖的package包/类
/**
 * 用于小圆点的放大缩小
 * @param view
 * @param type
 */
private void targetViewAnim(final View view, final int type){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator scaleX = null;
    ObjectAnimator scaleY = null;
    ObjectAnimator alpha = null;
    if (type == ANIM_OUT){
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",SCALE_MIN,mScale_max);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",SCALE_MIN,mScale_max);
        alpha = ObjectAnimator.ofFloat(view,"alpha",mAlpha_min,ALPHA_MAX);
        animatorSet.setDuration(ANIM_OUT_TIME);
    }else{
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",mScale_max,SCALE_MIN);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",mScale_max,SCALE_MIN);
        alpha = ObjectAnimator.ofFloat(view,"alpha",ALPHA_MAX,mAlpha_min);
        animatorSet.setDuration(ANIM_IN_TIME);
    }
    animatorSet.play(scaleX).with(scaleY).with(alpha);

    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.start();

}
 
开发者ID:LillteZheng,项目名称:ViewPagerHelper,代码行数:28,代码来源:ZoomIndicator.java

示例6: initAnimator

import android.animation.ObjectAnimator; //导入依赖的package包/类
private void initAnimator() {
    if (mObjectAnimator == null) {
        mObjectAnimator = ObjectAnimator.ofInt(3, 6);
        mObjectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int value = (int) animation.getAnimatedValue();
                if (value != last) {
                    last = value;
                    factor = last / 10f;
                    L.e("call: onAnimationUpdate([animation])-> " + factor);
                    postInvalidate();
                }
            }
        });
        mObjectAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mObjectAnimator.setRepeatMode(ValueAnimator.REVERSE);
        mObjectAnimator.setDuration(300);
        mObjectAnimator.start();
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:22,代码来源:EmptyView.java

示例7: showContent

import android.animation.ObjectAnimator; //导入依赖的package包/类
@Override public void showContent() {

    if (adapter.getItemCount() == 0) {
      if (isRestoringViewState()) {
        emptyView.setVisibility(View.VISIBLE);
      } else {
        ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
        anim.setStartDelay(250);
        anim.addListener(new AnimatorListenerAdapter() {

          @Override public void onAnimationStart(Animator animation) {
            emptyView.setVisibility(View.VISIBLE);
          }
        });
        anim.start();
      }
    } else {
      emptyView.setVisibility(View.GONE);
    }

    super.showContent();
  }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:AuthRefreshRecyclerFragment.java

示例8: startSecondAnimation

import android.animation.ObjectAnimator; //导入依赖的package包/类
public void startSecondAnimation(View view) {
    ObjectAnimator rotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 0f, 25f);
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(mView1, "alpha", 0.5f, 1f);
    ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(mView1, "scaleX", 0.8f, 1f);
    ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(mView1, "scaleY", 0.8f, 1f);
    ObjectAnimator translationYAnimation = ObjectAnimator.ofFloat(mView1, "translationY", -0.1f * mView1.getHeight(), 0f);
    ObjectAnimator rerotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 25f, 0f);
    rerotationXAnimation.setStartDelay(200);
    ObjectAnimator translationYAnimation2 = ObjectAnimator.ofFloat(mView2, "translationY", 0, mView2.getHeight());
    translationYAnimation2.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mView2.setVisibility(View.INVISIBLE);
        }
    });

    AnimatorSet as = new AnimatorSet();
    as.playTogether(rotationXAnimation, alphaAnimation, scaleXAnimation, scaleYAnimation,
            translationYAnimation,
            rerotationXAnimation, translationYAnimation2);
    as.setDuration(200);
    as.start();
}
 
开发者ID:GitLqr,项目名称:MaterialDesignDemo,代码行数:25,代码来源:ObjectAnimationActivity2.java

示例9: onDrawState

import android.animation.ObjectAnimator; //导入依赖的package包/类
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    final int width = rv.getMeasuredWidth();
    final int height = rv.getMeasuredHeight();

    // Draw all of our content items
    renderContent(numberOfContentItems, width, height, canvas, contentPaint);

    // Setup and start animation, if possible
    if (animateContentItems) {
        if (anim == null) {
            this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
                    Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
            onInterceptAnimatorCreation(anim);
            this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    rv.invalidate();
                }
            });
            this.anim.start();
        }
    }
}
 
开发者ID:tylersuehr7,项目名称:empty-state-recyclerview,代码行数:25,代码来源:AbstractContentLoadingState.java

示例10: runTestChangeAnimation

import android.animation.ObjectAnimator; //导入依赖的package包/类
/**
 * Procedure meant to execute a change animation for the desired {@link RecyclerView.ViewHolder}.
 * @param holder the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
 * @param itemView the {@link RecyclerView.ViewHolder}'s root view.
 * @param listener the {@link GenericItemAnimator} instance orchestrating the animations.
 * @return the resulting {@link AnimatorSet} for the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
 */
public static AnimatorSet runTestChangeAnimation(@NonNull final RecyclerView.ViewHolder holder,
                                          @NonNull final View itemView,
                                          @NonNull final GenericItemAnimator listener) {
    final ObjectAnimator oldTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, 0, 90);
    final ObjectAnimator newTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, -90, 0);
    final AnimatorSet textAnim = new AnimatorSet();

    textAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(@NonNull final Animator animation) {
            listener.onAnimationFinished(holder, CHANGE_ANIMATION_FINISHED);
        }
    });

    textAnim.playSequentially(oldTextRotate, newTextRotate);
    return textAnim;
}
 
开发者ID:Simdea,项目名称:gmlrva,代码行数:25,代码来源:ViewHolderAnimationHelper.java

示例11: hide

import android.animation.ObjectAnimator; //导入依赖的package包/类
/**
 * 隐藏下面的菜单
 */
private void hide() {
    rel.startAnimation(mHiddenAction);
    rel.setVisibility(View.INVISIBLE);

    mFloatingActionsMenu.startAnimation(mHiddenAction1);
    mFloatingActionsMenu.setVisibility(View.INVISIBLE);

    animatorHeadHide = ObjectAnimator.ofFloat(vvv, "translationY", 0, -headHight);
    animatorHeadHide.setDuration(666);
    animatorHeadHide.start();


    animatorHeadHide.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.e("lllxxx",animation.getAnimatedValue()+"===");
            linearParams.height = headHight+(int)((float)animation.getAnimatedValue());
            head.setLayoutParams(linearParams);
        }
    });

}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:26,代码来源:DownUpActivity.java

示例12: alphaObjectAnimator

import android.animation.ObjectAnimator; //导入依赖的package包/类
protected ObjectAnimator alphaObjectAnimator(View view, final boolean fadeIn, long duration, boolean postBack) {
    final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", fadeIn ? new float[]{
            0f, 1f} : new float[]{1f, 0f});

    anim.setDuration(duration);

    if (postBack) {
        final WeakReference<View> wr = new WeakReference<>(view);
        anim.addListener(new ManipulateAnimatorListener() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (wr.get() != null) {
                    wr.get().setAlpha(fadeIn ? 0 : 1);
                }
            }
        });
    }

    return anim;
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:21,代码来源:QMUIAnimationListView.java

示例13: startBeatsAnimation

import android.animation.ObjectAnimator; //导入依赖的package包/类
@UiThread public static void startBeatsAnimation(@NonNull View view) {
    view.clearAnimation();
    if (view.getAnimation() != null) {
        view.getAnimation().cancel();
    }
    List<ObjectAnimator> animators = getBeats(view);
    for (ObjectAnimator anim : animators) {
        anim.setDuration(300).start();
        anim.setInterpolator(interpolator);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:12,代码来源:AnimHelper.java

示例14: initAnim

import android.animation.ObjectAnimator; //导入依赖的package包/类
private void initAnim() {

        animationDrawable = new AnimationDrawable();
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode1), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode2), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode3), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode4), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode5), 100);
        animationDrawable.setOneShot(true);
        animationDrawable.setExitFadeDuration(300);
        animationDrawable.setEnterFadeDuration(100);

        ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(null, "scaleX", 1.f, 0.f);
        ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(null, "scaleY", 1.f, 0.f);
        animatorSet = new AnimatorSet();
        animatorSet.setDuration(300l);
        animatorSet.playTogether(objectAnimator1, objectAnimator2);

        objectAnimator = ObjectAnimator.ofFloat(null, "alpha", 1.f, 0.f);
        objectAnimator.setDuration(2000l);
    }
 
开发者ID:javonleee,项目名称:DragPointView,代码行数:22,代码来源:SampleActivity.java

示例15: closeStickersView

import android.animation.ObjectAnimator; //导入依赖的package包/类
private void closeStickersView() {
    if (stickersView == null || stickersView.getVisibility() != VISIBLE) {
        return;
    }
    pickingSticker = false;

    Animator a = ObjectAnimator.ofFloat(stickersView, "alpha", 1.0f, 0.0f);
    a.setDuration(200);
    a.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animator) {
            stickersView.setVisibility(GONE);
        }
    });
    a.start();

    undoItem.setVisibility(VISIBLE);
    actionBar.setTitle(LocaleController.getString("PaintDraw", R.string.PaintDraw));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:20,代码来源:PhotoPaintView.java


注:本文中的android.animation.ObjectAnimator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。