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


Java ObjectAnimator.ofPropertyValuesHolder方法代码示例

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


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

示例1: createHideItemAnimator

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

        Animator anim = ObjectAnimator.ofPropertyValuesHolder(
                item,
//                AnimatorUtils.rotation(720f, 0f),
                AnimatorUtils.translationX(0f, dx),
                AnimatorUtils.translationY(0f, dy)
        );

        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                item.setTranslationX(0f);
                item.setTranslationY(0f);
            }
        });

        return anim;
    }
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:23,代码来源:MainActivity.java

示例2: getPulseAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * Render an animator to pulsate a view in place.
 *
 * @param labelToAnimate the view to pulsate.
 * @return The animator object. Use .start() to begin.
 */
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
                                              float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);

    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator =
            ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

    return pulseAnimator;
}
 
开发者ID:ttpho,项目名称:TimePicker,代码行数:22,代码来源:Utils.java

示例3: buildAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public Animator buildAnimation(@NonNull ViewDefault viewDefault, @NonNull View viewToMorph, boolean isReversed) {
    if (!isReversed) {
        initialAlpha = viewDefault.getAlpha();
    }
    float alphaValue = isReversed ? initialAlpha : targetAlpha;
    alphaValue = alphaValue < 0 ? 0 : alphaValue;
    alphaValue = alphaValue > 1 ? 1 : alphaValue;
    viewDefault.setAlpha(alphaValue);
    PropertyValuesHolder[] parameters = new PropertyValuesHolder[1];
    parameters[0] = PropertyValuesHolder.ofFloat(View.ALPHA, alphaValue);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(viewToMorph, parameters);
    if (duration >= 0) {
        animator.setDuration(duration);
    }
    if (interpolator != null) {
        animator.setInterpolator(interpolator);
    }
    return animator;
}
 
开发者ID:rjsvieira,项目名称:morphos,代码行数:21,代码来源:AlphaAnimation.java

示例4: apply

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0)
    );
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new LinearInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:20,代码来源:AlphaHideAnimator.java

示例5: apply

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationX", view.getLeft(), view.getRight()));
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new AnticipateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:20,代码来源:TranslationHideAnimator.java

示例6: onDisappear

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                            TransitionValues endValues) {
    return ObjectAnimator.ofPropertyValuesHolder(
            view,
            PropertyValuesHolder.ofFloat(View.ALPHA, 0f),
            PropertyValuesHolder.ofFloat(View.SCALE_X, 0f),
            PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f));
}
 
开发者ID:alphater,项目名称:garras,代码行数:10,代码来源:Pop.java

示例7: animateMenuClosing

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void animateMenuClosing(Point center) {
    super.animateMenuOpening(center);

    setAnimating(true);

    Animator lastAnimation = null;
    for (int i = 0; i < menu.getSubActionItems().size(); i++) {
        PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, - (menu.getSubActionItems().get(i).x - center.x + menu.getSubActionItems().get(i).width / 2));
        PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, - (menu.getSubActionItems().get(i).y - center.y + menu.getSubActionItems().get(i).height / 2));
        PropertyValuesHolder pvhR = PropertyValuesHolder.ofFloat(View.ROTATION, -720);
        PropertyValuesHolder pvhsX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
        PropertyValuesHolder pvhsY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);
        PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat(View.ALPHA, 0);

        final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(menu.getSubActionItems().get(i).view, pvhX, pvhY, pvhR, pvhsX, pvhsY, pvhA);
        animation.setDuration(DURATION);
        animation.setInterpolator(new AccelerateDecelerateInterpolator());
        animation.addListener(new SubActionItemAnimationListener(menu.getSubActionItems().get(i), ActionType.CLOSING));

        if(i == 0) {
            lastAnimation = animation;
        }

        animation.setStartDelay((menu.getSubActionItems().size() - i) * LAG_BETWEEN_ITEMS);
        animation.start();
    }
    if(lastAnimation != null) {
        lastAnimation.addListener(new LastAnimationListener());
    }
}
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:32,代码来源:DefaultAnimationHandler.java

示例8: initAnim

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void initAnim() {
    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);
        float transX = (float) ((i + 1) * 0.06);
        float transY = (float) ((i + 1) * 0.12);
        ObjectAnimator animator;

        PropertyValuesHolder valuesHolderX = PropertyValuesHolder.ofFloat("XFraction", 0, transX);
        PropertyValuesHolder valuesHolderY = PropertyValuesHolder.ofFloat("YFraction", 0, transY);
        animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderX, valuesHolderY);
        animator.setInterpolator(mInterpolator);
        animator.setDuration(300);
        mOpenAnimators[i] = animator;

        PropertyValuesHolder valuesHolderXReverse = PropertyValuesHolder.ofFloat("XFraction", transX, 1);
        animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderXReverse);
        animator.setInterpolator(mInterpolator);
        animator.setDuration(300);
        mChosenAnimators[i] = animator;

        PropertyValuesHolder valuesHolderAlpha = PropertyValuesHolder.ofFloat("menuAlpha", 1, 0);
        animator = ObjectAnimator.ofPropertyValuesHolder(child, valuesHolderAlpha);
        animator.setInterpolator(mInterpolator);
        animator.setDuration(300);
        mMenuOpenAnimators[i] = animator;
    }
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:28,代码来源:CoolMenuFrameLayout.java

示例9: createNewTabOpenedAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private Animator createNewTabOpenedAnimator(
        StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) {
    Tab tab = model.getTabAt(focusIndex);
    if (tab == null || !tab.isNativePage()) return null;

    View view = tab.getView();
    if (view == null) return null;

    // Set up the view hierarchy
    if (view.getParent() != null) ((ViewGroup) view.getParent()).removeView(view);
    ViewGroup bgView = new FrameLayout(view.getContext());
    bgView.setBackgroundColor(tab.getBackgroundColor());
    bgView.addView(view);
    container.addView(
            bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    // Update any compositor state that needs to change
    if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) {
        tabs[focusIndex].setAlpha(0.f);
    }

    // Build the view animations
    PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f);
    PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f);
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(
            bgView, xScale, yScale, alpha);

    animator.setDuration(TAB_OPENED_ANIMATION_DURATION);
    animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE);

    float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx;

    bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP);
    bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx);
    return animator;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:38,代码来源:StackViewAnimation.java

示例10: createAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private static @Nullable
ObjectAnimator createAnimator(@NonNull WXAnimationBean animation, final View target) {
  if(target == null){
    return null;
  }
  WXAnimationBean.Style style = animation.styles;
  if (style != null) {
    ObjectAnimator animator;
    List<PropertyValuesHolder> holders =style.getHolders();
    if (!TextUtils.isEmpty(style.backgroundColor)) {
      BorderDrawable borderDrawable;
      if ((borderDrawable=WXViewUtils.getBorderDrawable(target))!=null) {
        holders.add(PropertyValuesHolder.ofObject(
            WXAnimationBean.Style.BACKGROUND_COLOR, new ArgbEvaluator(),
            borderDrawable.getColor(),
            WXResourceUtils.getColor(style.backgroundColor)));
      } else if (target.getBackground() instanceof ColorDrawable) {
        holders.add(PropertyValuesHolder.ofObject(
            WXAnimationBean.Style.BACKGROUND_COLOR, new ArgbEvaluator(),
            ((ColorDrawable) target.getBackground()).getColor(),
            WXResourceUtils.getColor(style.backgroundColor)));
      }
    }
    if (style.getPivot() != null) {
      Pair<Float, Float> pair = style.getPivot();
      target.setPivotX(pair.first);
      target.setPivotY(pair.second);
    }
    animator = ObjectAnimator.ofPropertyValuesHolder(
        target, holders.toArray(new PropertyValuesHolder[holders.size()]));
    animator.setStartDelay(animation.delay);
    final IntEvaluator intEvaluator=new IntEvaluator();
    if (target.getLayoutParams() != null &&
        (!TextUtils.isEmpty(style.width) || !TextUtils.isEmpty(style.height))) {
      DimensionUpdateListener listener = new DimensionUpdateListener(target);
      ViewGroup.LayoutParams layoutParams = target.getLayoutParams();
      if (!TextUtils.isEmpty(style.width)) {
        listener.setWidth(layoutParams.width,
                          (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.width)));
      }
      if (!TextUtils.isEmpty(style.height)) {
        listener.setHeight(layoutParams.height,
                           (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.height)));
      }
      animator.addUpdateListener(listener);
    }
    return animator;
  } else {
    return null;
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:52,代码来源:WXAnimationModule.java

示例11: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();

    animators.add(animator);
    return animators;
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:16,代码来源:TriangleSkewSpinIndicator.java

示例12: onFocusChange

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void onFocusChange(View v, boolean hasFocus) {
    if (hasFocus) {
        endCurrentAnimation();

        if (mAlpha > MIN_VISIBLE_ALPHA) {
            mTargetView = v;

            mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this,
                    PropertyValuesHolder.ofFloat(ALPHA, 1),
                    PropertyValuesHolder.ofFloat(SHIFT, 1));
            mCurrentAnimation.addListener(new ViewSetListener(v, true));
        } else {
            setCurrentView(v);

            mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this,
                    PropertyValuesHolder.ofFloat(ALPHA, 1));
        }

        mLastFocusedView = v;
    } else {
        if (mLastFocusedView == v) {
            mLastFocusedView = null;
            endCurrentAnimation();
            mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this,
                    PropertyValuesHolder.ofFloat(ALPHA, 0));
            mCurrentAnimation.addListener(new ViewSetListener(null, false));
        }
    }

    // invalidate once
    invalidateDirty();

    mLastFocusedView = hasFocus ? v : null;
    if (mCurrentAnimation != null) {
        mCurrentAnimation.addUpdateListener(this);
        mCurrentAnimation.setDuration(ANIM_DURATION).start();
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:40,代码来源:FocusIndicatorHelper.java

示例13: getRotation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private Animator getRotation(AnimationBody animationBody, View view) {
    final float force = animationBody.getForce();

    float[] rotationValues = {
            (float) Math.toDegrees(0),
            (float) Math.toDegrees(0.3f * force),
            (float) Math.toDegrees(-0.3f * force),
            (float) Math.toDegrees(0.3f * force),
            (float) Math.toDegrees(0f),
            (float) Math.toDegrees(0f)
    };

    final PropertyValuesHolder pvhRotation =
            PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, rotationValues));

    final ObjectAnimator animation =
            ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation);

    animation.setInterpolator(new LinearInterpolator());

    return animation;
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:23,代码来源:Wobble.java

示例14: getScalingAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public ObjectAnimator getScalingAnimator() {
    PropertyValuesHolder imgViewScaleY = PropertyValuesHolder.ofFloat(View
            .SCALE_Y, SCALE_FACTOR);
    PropertyValuesHolder imgViewScaleX = PropertyValuesHolder.ofFloat(View
            .SCALE_X, SCALE_FACTOR);

    ObjectAnimator imgViewScaleAnimator = ObjectAnimator
            .ofPropertyValuesHolder(this, imgViewScaleX, imgViewScaleY);
    imgViewScaleAnimator.setRepeatCount(1);
    imgViewScaleAnimator.setRepeatMode(ValueAnimator.REVERSE);
    imgViewScaleAnimator.setDuration(ANIMATION_DURATION);

    return imgViewScaleAnimator;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:15,代码来源:RoundView.java

示例15: suicaRunner

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
protected Runnable suicaRunner(final float x1, final float y1, final float x2, final float y2){
    final float attackTime = 0.9f;
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", x1, x2);
            PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", y1, y2);
            PropertyValuesHolder holderRotation = PropertyValuesHolder.ofFloat("rotation", 0, 359);

            ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(Suica.this, holderX, holderY, holderRotation);
            objectAnimator.setDuration(mTime);
            objectAnimator.start();

            Suica.this.setVisibility(View.VISIBLE);
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if(!mClicked) {
                        Suica.this.setVisibility(View.INVISIBLE);
                        damageButton.callOnClick();
                    }
                }
            }, (int)(mTime * attackTime));
        }
    };
    return  runnable;
}
 
开发者ID:ShitamatsugeFactory,项目名称:KokoWalk,代码行数:28,代码来源:Suica.java


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