Java 类com.nineoldandroids.animation.ValueAnimator 实例源码

项目:NeteaseCloudMusic    文件:ScanMusicActivity.java   
private void initAnimations() {
    searchAnimation = ValueAnimator.ofFloat(0f, 1f);
    searchAnimation.setDuration(50000);
    searchAnimation.setRepeatCount(ValueAnimator.INFINITE);
    searchAnimation.setRepeatMode(ValueAnimator.RESTART);
    searchAnimation.setInterpolator(new LinearInterpolator());
    searchAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float angle = (valueAnimator.getAnimatedFraction() * 360);
            ViewHelper.setTranslationX(ivSearch, (float) Math.sin(angle) * radius);
            ViewHelper.setTranslationY(ivSearch, (float) Math.cos(angle) * radius);
        }
    });


    scanAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.61f);
    scanAnimation.setDuration(2000);
    scanAnimation.setRepeatCount(TranslateAnimation.INFINITE);
    scanAnimation.setRepeatMode(TranslateAnimation.RESTART);
}
项目:exciting-app    文件:ViewPropertyAnimatorHC.java   
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
项目:exciting-app    文件:ViewPropertyAnimatorPreHC.java   
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
项目:exciting-app    文件:AnimationBuilder.java   
/**
 * Custom animation builder.
 *
 * @param update the update
 * @param values the values
 * @return the animation builder
 */
public AnimationBuilder custom(final AnimationListener.Update update, float... values) {
    for (final View view : views) {
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(getValues(values));
        if (update != null)
            valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    //noinspection unchecked
                    update.update(view, (Float) animation.getAnimatedValue());
                }
            });
        add(valueAnimator);
    }
    return this;
}
项目:CustomWeight    文件:ParallaxListView.java   
@Override
public boolean onTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_UP) {
        // 恢复高度
        final ValueAnimator animator = ValueAnimator.ofInt(parallaxImageView.getHeight(), originalHeight);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                Integer animateValue = (Integer) animator.getAnimatedValue();
                // 给 ImageView 设置值
                parallaxImageView.getLayoutParams().height = animateValue;
                parallaxImageView.requestLayout();
            }
        });
        animator.setInterpolator(new OvershootInterpolator()); // 弹性差值器
        animator.setDuration(450);
        animator.start();
    }
    return super.onTouchEvent(ev);
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorHC.java   
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(new float[]{1.0f});
    ArrayList<NameValuesHolder> nameValueList = (ArrayList) this.mPendingAnimations.clone();
    this.mPendingAnimations.clear();
    int propertyMask = 0;
    for (int i = 0; i < nameValueList.size(); i++) {
        propertyMask |= ((NameValuesHolder) nameValueList.get(i)).mNameConstant;
    }
    this.mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(this.mAnimatorEventListener);
    animator.addListener(this.mAnimatorEventListener);
    if (this.mStartDelaySet) {
        animator.setStartDelay(this.mStartDelay);
    }
    if (this.mDurationSet) {
        animator.setDuration(this.mDuration);
    }
    if (this.mInterpolatorSet) {
        animator.setInterpolator(this.mInterpolator);
    }
    animator.start();
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorPreHC.java   
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(new float[]{1.0f});
    ArrayList<NameValuesHolder> nameValueList = (ArrayList) this.mPendingAnimations.clone();
    this.mPendingAnimations.clear();
    int propertyMask = 0;
    for (int i = 0; i < nameValueList.size(); i++) {
        propertyMask |= ((NameValuesHolder) nameValueList.get(i)).mNameConstant;
    }
    this.mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(this.mAnimatorEventListener);
    animator.addListener(this.mAnimatorEventListener);
    if (this.mStartDelaySet) {
        animator.setStartDelay(this.mStartDelay);
    }
    if (this.mDurationSet) {
        animator.setDuration(this.mDuration);
    }
    if (this.mInterpolatorSet) {
        animator.setInterpolator(this.mInterpolator);
    }
    animator.start();
}
项目:Harmony-Music-Player    文件:FastScroller.java   
private void hideBubble() {

        if (mBubbleAnimator == null) {
            mBubbleAnimator = ValueAnimator.ofFloat(1.0F, 0.0F);
            mBubbleAnimator.addUpdateListener(mBubbleAnimatorListener);
            mBubbleAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mBubbleVisible = false;
                    invalidate();
                }
            });
        } else {
            mBubbleAnimator.cancel();
        }


        mBubbleAnimator.start();
    }
项目:Harmony-Music-Player    文件:FastScroller.java   
private void hideScroller() {

        if (mScrollerAnimator == null) {
            mScrollerAnimator = ValueAnimator.ofFloat(1.0F, 0.0F);
            mScrollerAnimator.addUpdateListener(mHandleAnimatorListener);
            mScrollerAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mScrollerVisible = false;
                    invalidate();
                }
            });
        } else {
            mScrollerAnimator.cancel();
        }


        mScrollerAnimator.start();


    }
项目:Coding-Android    文件:EnterEmojiLayout.java   
private void dropTempWindow() {
    mInputBox.setVisibility(View.INVISIBLE);
    ValueAnimator va = ValueAnimator.ofInt(mEnterLayoutAnimSupportContainer.softkeyboardOpenY, mEnterLayoutAnimSupportContainer.openY);
    va.setDuration(300);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int y = (int) animation.getAnimatedValue();
            int b = (y - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) * panelHeight / (mEnterLayoutAnimSupportContainer.openY - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) - panelHeight;
            moveTempWindow(y);
            updateEnterLayoutBottom(b);
            if (y == mEnterLayoutAnimSupportContainer.openY) {
                removeTempWindow();
                mInputBox.setVisibility(View.VISIBLE);
            }
        }
    });
    va.start();

}
项目:MyTravelingDiary    文件:EnterEmojiLayout.java   
private void dropTempWindow() {
    mInputBox.setVisibility(View.INVISIBLE);
    ValueAnimator va = ValueAnimator.ofInt(mEnterLayoutAnimSupportContainer.softkeyboardOpenY, mEnterLayoutAnimSupportContainer.openY);
    va.setDuration(300);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int y = (int) animation.getAnimatedValue();
            int b = (y - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) * panelHeight / (mEnterLayoutAnimSupportContainer.openY - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) - panelHeight;
            moveTempWindow(y);
            updateEnterLayoutBottom(b);
            if (y == mEnterLayoutAnimSupportContainer.openY) {
                removeTempWindow();
                mInputBox.setVisibility(View.VISIBLE);
            }
        }
    });
    va.start();

}
项目:ListViewAnimations    文件:ExpandableListItemAdapter.java   
public static ValueAnimator createHeightAnimator(final View view, final int start, final int end) {
    ValueAnimator animator = ValueAnimator.ofInt(start, end);
    animator.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(final ValueAnimator animation) {
                    int value = (Integer) animation.getAnimatedValue();

                    LayoutParams layoutParams = view.getLayoutParams();
                    layoutParams.height = value;
                    view.setLayoutParams(layoutParams);
                }
            }
    );
    return animator;
}
项目:AndroidObservableScrollView-master    文件:ViewPagerTab2Activity.java   
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                ViewHelper.setTranslationY(mInterceptionLayout, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
项目:AndroidObservableScrollView-master    文件:ToolbarControlBaseActivity.java   
private void moveToolbar(float toTranslationY) {
    if (ViewHelper.getTranslationY(mToolbar) == toTranslationY) {
        return;
    }
    ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mToolbar), toTranslationY).setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float translationY = (float) animation.getAnimatedValue();
            ViewHelper.setTranslationY(mToolbar, translationY);
            ViewHelper.setTranslationY((View) mScrollable, translationY);
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) ((View) mScrollable).getLayoutParams();
            lp.height = (int) -translationY + getScreenHeight() - lp.topMargin;
            ((View) mScrollable).requestLayout();
        }
    });
    animator.start();
}
项目:AndroidObservableScrollView-master    文件:ViewPagerTabFragmentParentFragment.java   
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                View toolbarView = getActivity().findViewById(R.id.toolbar);
                ViewHelper.setTranslationY(mInterceptionLayout, translationY);
                ViewHelper.setTranslationY(toolbarView, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
项目:AndroidObservableScrollView-master    文件:ViewPagerTab2Activity.java   
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                ViewHelper.setTranslationY(mInterceptionLayout, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
项目:AndroidColorPop    文件:PopBackgroundView.java   
/**
 * Internal void to start the circles animation.
 * <p>
 * when this void is called the circles radius would be updated by a
 * {@link ValueAnimator} and then it will call the {@link View}'s
 * invalidate() void witch calls the onDraw void each time so a bigger
 * circle would be drawn each time till the cirlce's fill the whole screen.
 * </p>
 */
private void animateCirlce() {
    if (circles_fill_type == CIRLCES_FILL_HEIGHT_TYPE) {
        circle_max_radius = screen_height + (screen_height / 4);
    } else {
        circle_max_radius = screen_width + (screen_width / 4);
    }
    ValueAnimator va = ValueAnimator.ofInt(0, circle_max_radius / 3);
    va.setDuration(1000);
    va.addListener(this);
    va.setInterpolator(new AccelerateInterpolator());
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            int value = (int) animation.getAnimatedValue();
            circle_radius = value * 3;
            invalidate();
        }
    });
    va.start();
}
项目:AndroidColorPop    文件:PopBackgroundView.java   
/**
 * Internal void to start the rectangle animation.
 * <p>
 * when this void is called the space at the top of the rectangle would be
 * updated by a {@link ValueAnimator} and then it will call the {@link View}
 * 's invalidate() void witch calls the onDraw void each time so a bigger
 * rectangle would be drawn each time till the it the rectangles height is
 * enough
 * </p>
 */
private void animateRect() {
    ValueAnimator va = ValueAnimator.ofInt(rect_space_top / 2,
            screen_height / 2);
    va.setDuration(500);
    va.addListener(this);
    va.setInterpolator(new DecelerateInterpolator());
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            int value = ((int) animation.getAnimatedValue()) * 2;
            int rect_top = -((value - rect_space_top) - screen_height);
            rect.top = rect_top;
            invalidate();
        }
    });
    va.start();
}
项目:android-open-project-demo-master    文件:ContextualUndoAdapter.java   
private void performRemovalIfNecessary() {
    if (mCurrentRemovedId == -1) {
        return;
    }

    ContextualUndoView currentRemovedView = getCurrentRemovedView(mCurrentRemovedView, mCurrentRemovedId);
    if (currentRemovedView != null) {
        ValueAnimator animator = ValueAnimator.ofInt(currentRemovedView.getHeight(), 1).setDuration(ANIMATION_DURATION);

        RemoveViewAnimatorListenerAdapter listener = new RemoveViewAnimatorListenerAdapter(currentRemovedView, mCurrentRemovedId);
        RemoveViewAnimatorUpdateListener updateListener = new RemoveViewAnimatorUpdateListener(listener);

        animator.addListener(listener);
        animator.addUpdateListener(updateListener);
        animator.start();
    } else {
        // The hard way.
        deleteItemGivenId(mCurrentRemovedId);
    }
    clearCurrentRemovedView();
}
项目:android-open-project-demo-master    文件:SwipeDismissListViewTouchListener.java   
protected void performDismiss(final PendingDismissData data) {
    // Animate the dismissed list item to zero-height and fire the
    // dismiss callback when all dismissed list item animations have
    // completed.

    final ViewGroup.LayoutParams lp = data.view.getLayoutParams();
    final int originalHeight = data.view.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime);

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(final ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            data.view.setLayoutParams(lp);
        }
    });

    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(final Animator animation) {
            finalizeDismiss();
        }
    });
    animator.start();
}
项目:jianguo    文件:CommonTabLayout.java   
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
    IndicatorPoint p = (IndicatorPoint) animation.getAnimatedValue();
    mIndicatorRect.left = (int) p.left;
    mIndicatorRect.right = (int) p.right;

    if (mIndicatorWidth < 0) {   //indicatorWidth小于0时,原jpardogo's PagerSlidingTabStrip

    } else {//indicatorWidth大于0时,圆角矩形以及三角形
        float indicatorLeft = p.left + (currentTabView.getWidth() - mIndicatorWidth) / 2;

        mIndicatorRect.left = (int) indicatorLeft;
        mIndicatorRect.right = (int) (mIndicatorRect.left + mIndicatorWidth);
    }
    invalidate();
}
项目:SimplifyReader2    文件:PlayerDiscView.java   
private void startDiscAnimator(float animatedValue) {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
    mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
    mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
项目:SimplifyReader2    文件:PlayerDiscView.java   
private void reverseDiscAnimator() {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
    mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
项目:AyoSunny    文件:LineScalePulseOutIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{500,250,0,250,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
        scaleAnim.setDuration(900);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:AyoSunny    文件:LineScalePartyIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] durations=new long[]{1260, 430, 1010, 730};
    long[] delays=new long[]{770, 290, 280, 740};
    for (int i = 0; i < 4; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
        scaleAnim.setDuration(durations[i]);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:AyoSunny    文件:BallPulseSyncIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    float circleSpacing=4;
    float radius=(getWidth()-circleSpacing*2)/6;
    int[] delays=new int[]{70,140,210};
    for (int i = 0; i < 3; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(getHeight()/2,getHeight()/2-radius*2,getHeight()/2);
        scaleAnim.setDuration(600);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                translateYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:AyoSunny    文件:LineScalePulseOutRapidIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{400,200,0,200,400};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:AyoSunny    文件:BallRotateIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    ValueAnimator scaleAnim=ValueAnimator.ofFloat(0.5f,1,0.5f);
    scaleAnim.setDuration(1000);
    scaleAnim.setRepeatCount(-1);
    scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            scaleFloat = (float) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    scaleAnim.start();

    ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
    rotateAnim.setDuration(1000);
    rotateAnim.setRepeatCount(-1);
    rotateAnim.start();

    animators.add(scaleAnim);
    animators.add(rotateAnim);
    return animators;
}
项目:AyoSunny    文件:BallGridBeatIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();

    int[] durations={960, 930, 1190, 1130, 1340, 940, 1200, 820, 1190};
    int[] delays= {360, 400, 680, 410, 710, -150, -120, 10, 320};

    for (int i = 0; i < 9; i++) {
        final int index=i;
        ValueAnimator alphaAnim=ValueAnimator.ofInt(255, 168,255);
        alphaAnim.setDuration(durations[i]);
        alphaAnim.setRepeatCount(-1);
        alphaAnim.setStartDelay(delays[i]);
        alphaAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                alphas[index] = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        alphaAnim.start();
        animators.add(alphaAnim);
    }
    return animators;
}
项目:AyoSunny    文件:BallPulseIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    int[] delays=new int[]{120,240,360};
    for (int i = 0; i < 3; i++) {
        final int index=i;

        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);

        scaleAnim.setDuration(750);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);

        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();

            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:AyoSunny    文件:LineScaleIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{100,200,300,400,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1, 0.4f, 1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
项目:TheSceneryAlong    文件:ViewPropertyAnimatorHC.java   
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
项目:TheSceneryAlong    文件:ViewPropertyAnimatorPreHC.java   
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
项目:CanAdapter    文件:ERVGridFragment.java   
public void expandView(final View view) {
    ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {


            ViewHelper.setRotation(view,180 * (float) (animation.getAnimatedValue()));


            view.postInvalidate();
        }
    });
    animator.start();

}
项目:CanAdapter    文件:ERVGridFragment.java   
public void collapseView(final View view) {
    ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {



            ViewHelper.setRotation(view,180 * (float) (animation.getAnimatedValue()));

            view.postInvalidate();
        }
    });
    animator.start();

}
项目:zone-sdk    文件:PathMeasureView.java   
public void setState(State state) {
    this.state = state;
    if (state == State.GetMatrix) {
        if (animator == null)
            animator = ValueAnimatorProxy.ofFloat(0, 1).setInterpolator(new LinearInterpolator()).setDuration(3000).setRepeatCount(-1)
                    .addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                        @Override
                        public void onAnimationUpdate(ValueAnimator animation) {
                            currentValue = (Float) animation.getAnimatedValue();
                            invalidate();
                        }
                    }).source();

        animator.start();
    } else if (animator != null)
        animator.cancel();

    invalidate();
}
项目:zone-sdk    文件:WaveHelper.java   
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    long currentTime = SystemClock.uptimeMillis();
    long costTime = currentTime - mLastTime;
    mLastTime = currentTime;

    speedOffsetX += mSpeed * costTime / 1000;
    if (speedOffsetX >= mLength)
        speedOffsetX = speedOffsetX % mLength;

    if (callback != null)
        callback.refresh(getWave());
    else
        getWave();

}
项目:CanAnimation    文件:CanAnimation.java   
/**
 * 属性动画循环一定次数
 * @param count
 * @param animator
 * @return
 */
@NonNull
public static Animator valueAnimatorRepeat(final int count, @NonNull Animator animator) {
    if (count <= 1 && count != -1)
        return animator;

    if (animator instanceof ValueAnimator) {
        ValueAnimator valueAnimator = (ValueAnimator) animator;

        valueAnimator.setRepeatCount(Math.max(-1, count - 1));


        return valueAnimator;
    }

    return animator;
}
项目:EveryXDay    文件:ToolbarControlBaseActivity.java   
private void moveToolbar(float toTranslationY) {
    if (ViewHelper.getTranslationY(mToolbar) == toTranslationY) {
        return;
    }
    ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mToolbar), toTranslationY).setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float translationY = (float) animation.getAnimatedValue();
            ViewHelper.setTranslationY(mToolbar, translationY);
            ViewHelper.setTranslationY((View) mScrollable, translationY);
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) ((View) mScrollable).getLayoutParams();
            lp.height = (int) -translationY + getScreenHeight() - lp.topMargin;
            ((View) mScrollable).requestLayout();
        }
    });
    animator.start();
}
项目:LoadingImageView    文件:LoadingImageView.java   
private void initAnim() {
    stopAnim();
    //animator = ObjectAnimator.ofInt(this, "maskHeight", 0, imageHeight);
    animator = ObjectAnimator.ofInt(clipDrawable, "level", 0, 10000);
    animator.setDuration(animDuration);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            invalidate();
        }
    });
    if(autoStart){
        animator.start();
    }
}