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


Java ValueAnimator.addUpdateListener方法代码示例

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


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

示例1: startAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:31,代码来源:ViewPropertyAnimatorHC.java

示例2: custom

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:23,代码来源:AnimationBuilder.java

示例3: onTouchEvent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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);
}
 
开发者ID:sleticalboy,项目名称:CustomWeight,代码行数:21,代码来源:ParallaxListView.java

示例4: startAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:ViewPropertyAnimatorHC.java

示例5: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScalePulseOutIndicator.java

示例6: animateToolbar

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:20,代码来源:ViewPagerTab2Activity.java

示例7: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:27,代码来源:BallPulseIndicator.java

示例8: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScaleIndicator.java

示例9: animateToolbar

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:22,代码来源:ViewPagerTabFragmentParentFragment.java

示例10: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:25,代码来源:BallRotateIndicator.java

示例11: performRemovalIfNecessary

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:22,代码来源:ContextualUndoAdapter.java

示例12: performDismiss

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:27,代码来源:SwipeDismissListViewTouchListener.java

示例13: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:24,代码来源:LineScalePartyIndicator.java

示例14: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:haoguanqing,项目名称:Subreddit_Reader,代码行数:26,代码来源:BallGridBeatIndicator.java

示例15: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:haoguanqing,项目名称:Subreddit_Reader,代码行数:23,代码来源:LineScalePulseOutRapidIndicator.java


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