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


Java ValueAnimator.ofFloat方法代码示例

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


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

示例1: initAnimations

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

示例2: 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

示例3: 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

示例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: hideBubble

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

示例6: hideScroller

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();


    }
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:22,代码来源:FastScroller.java

示例7: 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

示例8: 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

示例9: createAnimation

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

示例10: 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:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScalePulseOutRapidIndicator.java

示例11: 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

示例12: 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

示例13: 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

示例14: expandView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();

}
 
开发者ID:canyinghao,项目名称:CanAdapter,代码行数:19,代码来源:ERVGridFragment.java

示例15: collapseView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
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();

}
 
开发者ID:canyinghao,项目名称:CanAdapter,代码行数:19,代码来源:ERVGridFragment.java


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