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


Java Animator.setTarget方法代码示例

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


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

示例1: addIndicator

import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(int orientation, @DrawableRes int backgroundDrawableId,
        Animator animator) {
    if (animator.isRunning()) {
        animator.end();
        animator.cancel();
    }

    View Indicator = new View(getContext());
    Indicator.setBackgroundResource(backgroundDrawableId);
    addView(Indicator, mIndicatorWidth, mIndicatorHeight);
    LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();

    if (orientation == HORIZONTAL) {
        lp.leftMargin = mIndicatorMargin;
        lp.rightMargin = mIndicatorMargin;
    } else {
        lp.topMargin = mIndicatorMargin;
        lp.bottomMargin = mIndicatorMargin;
    }

    Indicator.setLayoutParams(lp);

    animator.setTarget(Indicator);
    animator.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:CircleIndicator.java

示例2: setupValues

import android.animation.Animator; //导入方法依赖的package包/类
public UDAnimatorSet setupValues(Animator animator) {
    animator.setupStartValues();
    if (mTarget != null && mAnimators != null) {
        for (Animator anim : mAnimators) {
            anim.setTarget(mTarget.getView());
            anim.setupStartValues();
            if (anim instanceof ValueAnimator) {
                ((ValueAnimator) anim).setRepeatCount(mRepeatCount);
                ((ValueAnimator) anim).setRepeatMode(mRepeatMode);
                //TODO
            }
        }
        if (animator instanceof AnimatorSet) {
            ((AnimatorSet) animator).playTogether(mAnimators);
        }
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:19,代码来源:UDAnimatorSet.java

示例3: createShowUpAnimator

import android.animation.Animator; //导入方法依赖的package包/类
public Animator createShowUpAnimator(final View target) {
    if (mHasCustomAnimationParams) {
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_X, mShowUpStartXScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_Y, mShowUpStartYScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final AnimatorSet showUpAnimator = new AnimatorSet();
        showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
        showUpAnimator.setDuration(mShowUpDuration);
        showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
        return showUpAnimator;
    }
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mShowUpAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(DECELERATE_INTERPOLATOR);
    return animator;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:21,代码来源:KeyPreviewDrawParams.java

示例4: createDismissAnimator

import android.animation.Animator; //导入方法依赖的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

示例5: handleMessage

import android.animation.Animator; //导入方法依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case DISMISS_SPLASH:
            Animator animator = AnimatorInflater.loadAnimator(MainActivity.this, R.animator.splash);
            animator.setTarget(splash_img);
            animator.start();
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MainActivity.java

示例6: addIndicator

import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) {
    if (animator.isRunning()) animator.end();

    View Indicator = new View(getContext());
    Indicator.setBackgroundResource(backgroundDrawableId);
    addView(Indicator, mIndicatorWidth, mIndicatorHeight);
    LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
    lp.leftMargin = mIndicatorMargin;
    lp.rightMargin = mIndicatorMargin;
    Indicator.setLayoutParams(lp);

    animator.setTarget(Indicator);
    animator.start();
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:15,代码来源:CircleIndicator.java

示例7: next

import android.animation.Animator; //导入方法依赖的package包/类
public AnimatorComposer next(@NonNull Animator nextAnimator, View target) {
    if (target != null) {
        nextAnimator.setTarget(target);
    }
    latestAnimator.addListener(new AnimatorEndChain(nextAnimator));
    latestAnimator = nextAnimator;
    registeredAnimators.add(nextAnimator);
    return this;
}
 
开发者ID:elms1990,项目名称:many-faced-view,代码行数:10,代码来源:AnimatorComposer.java

示例8: getAnimatorSetForSort

import android.animation.Animator; //导入方法依赖的package包/类
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.setStartDelay(childView.getTimeOffset());
            animatorsList.add(animatorCopy);
        }
    }
    animatorSet.playTogether(animatorsList);

    return animatorSet;
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:28,代码来源:Spruce.java

示例9: startAsPop

import android.animation.Animator; //导入方法依赖的package包/类
/**
 * 对target截图然后设置给ImageView,让ImageView镜像在android.R.id.content的FrameLayout里面执行动画
 */
public void startAsPop()
{
    final AnimatorSet animatorSet = getSet();
    final ArrayList<Animator> listChild = animatorSet.getChildAnimations();
    if (listChild == null || listChild.isEmpty())
    {
        return;
    }
    final HashMap<View, ImageView> mapTargetPoper = new HashMap<>();
    for (Animator animator : listChild)
    {
        View target = (View) ((ObjectAnimator) animator).getTarget();
        if (target == null)
        {
            continue;
        }
        if (!mapTargetPoper.containsKey(target))
        {
            final Context context = target.getContext();
            if (context instanceof Activity)
            {
                PopImageView imageView = new PopImageView(context);
                imageView.setDrawingCacheView(target);
                imageView.attachTarget(target);

                animator.setTarget(imageView);
                mapTargetPoper.put(target, imageView);
            }
        } else
        {
            animator.setTarget(mapTargetPoper.get(target));
        }
    }
    start();
}
 
开发者ID:zj565061763,项目名称:animator,代码行数:39,代码来源:FAnimatorSet.java

示例10: start

import android.animation.Animator; //导入方法依赖的package包/类
private void start(Animator object, final OnPointDragListener removeListener) {
    view.setVisibility(View.VISIBLE);
    Animator copy = object.clone();
    copy.setTarget(view);
    copy.removeAllListeners();
    copy.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            animation.removeListener(this);
            end(removeListener);
        }
    });
    copy.start();
}
 
开发者ID:javonleee,项目名称:DragPointView,代码行数:16,代码来源:PointViewAnimObject.java

示例11: startSelectedViewOutAnimation

import android.animation.Animator; //导入方法依赖的package包/类
private void startSelectedViewOutAnimation(final int position) {
    Animator animator = mSelectionOutAnimator;
    animator.setTarget(mSelectorHolder.itemView);
    animator.start();
    animator.addListener(new AbstractAnimatorListener() {
        @Override
        public void onAnimationEnd(Animator animation) {
            //replace selected view
            mSelectorHolder.bindItemWildcardHelper(mInputAdapter, position);
            startSelectedViewInAnimation();
        }
    });
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:14,代码来源:HorizontalLoopBarView.java

示例12: startUnreveal

import android.animation.Animator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startUnreveal() {
    Animator animator = ViewAnimationUtils.createCircularReveal(previewChildView,
            getCenterX(previewChildView),
            getCenterY(previewChildView),
            getRadius(previewChildView), morphView.getWidth() * 2);
    animator.setTarget(previewChildView);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            previewChildView.animate().setListener(null);
            frameView.setVisibility(View.INVISIBLE);
            previewChildView.setVisibility(View.INVISIBLE);
            morphView.setVisibility(View.VISIBLE);
            morphView.animate()
                    .y(getHideY())
                    .scaleY(0.5f)
                    .scaleX(0.5f)
                    .setDuration(UNMORPH_MOVE_DURATION)
                    .setInterpolator(new AccelerateInterpolator())
                    .setListener(hideListener);
        }
    });
    frameView.animate().alpha(1f).setDuration(UNMORPH_UNREVEAL_DURATION)
            .setInterpolator(new AccelerateInterpolator());
    animator.setDuration(UNMORPH_UNREVEAL_DURATION)
            .setInterpolator(new AccelerateInterpolator());
    animator.start();
}
 
开发者ID:hongcwamazing,项目名称:PreviewSeekBar-master,代码行数:31,代码来源:PreviewAnimatorLollipopImpl.java

示例13: onFadeFromXML

import android.animation.Animator; //导入方法依赖的package包/类
@OnClick(R.id.fadeFromXML)
public void onFadeFromXML() {
    Animator animator = AnimatorInflater.loadAnimator(this, animateForward ? R.animator.fade_out : R.animator.fade_in);
    animator.setTarget(icon);
    animator.start();
    animateForward = !animateForward;
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:8,代码来源:ObjectAnimatorActivity.java

示例14: AnimatedVectorDrawableCompatState

import android.animation.Animator; //导入方法依赖的package包/类
public AnimatedVectorDrawableCompatState(Context context, AnimatedVectorDrawableCompatState copy, Callback owner, Resources res) {
    if (copy != null) {
        this.mChangingConfigurations = copy.mChangingConfigurations;
        if (copy.mVectorDrawable != null) {
            ConstantState cs = copy.mVectorDrawable.getConstantState();
            if (res != null) {
                this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(res);
            } else {
                this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable();
            }
            this.mVectorDrawable = (VectorDrawableCompat) this.mVectorDrawable.mutate();
            this.mVectorDrawable.setCallback(owner);
            this.mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
            this.mVectorDrawable.setAllowCaching(false);
        }
        if (copy.mAnimators != null) {
            int numAnimators = copy.mAnimators.size();
            this.mAnimators = new ArrayList(numAnimators);
            this.mTargetNameMap = new ArrayMap(numAnimators);
            for (int i = 0; i < numAnimators; i++) {
                Animator anim = (Animator) copy.mAnimators.get(i);
                Animator animClone = anim.clone();
                String targetName = (String) copy.mTargetNameMap.get(anim);
                animClone.setTarget(this.mVectorDrawable.getTargetByName(targetName));
                this.mAnimators.add(animClone);
                this.mTargetNameMap.put(animClone, targetName);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:AnimatedVectorDrawableCompat.java

示例15: setupAnimatorsForTarget

import android.animation.Animator; //导入方法依赖的package包/类
private void setupAnimatorsForTarget(String name, Animator animator) {
    animator.setTarget(this.mAnimatedVectorState.mVectorDrawable.getTargetByName(name));
    if (VERSION.SDK_INT < 21) {
        setupColorAnimator(animator);
    }
    if (this.mAnimatedVectorState.mAnimators == null) {
        this.mAnimatedVectorState.mAnimators = new ArrayList();
        this.mAnimatedVectorState.mTargetNameMap = new ArrayMap();
    }
    this.mAnimatedVectorState.mAnimators.add(animator);
    this.mAnimatedVectorState.mTargetNameMap.put(animator, name);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:AnimatedVectorDrawableCompat.java


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