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


Java ObjectAnimator.setDuration方法代码示例

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


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

示例1: animateShutter

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateShutter() {
    vShutter.setVisibility(View.VISIBLE);
    vShutter.setAlpha(0.f);

    ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f);
    alphaInAnim.setDuration(100);
    alphaInAnim.setStartDelay(100);
    alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR);

    ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f);
    alphaOutAnim.setDuration(200);
    alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playSequentially(alphaInAnim, alphaOutAnim);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            vShutter.setVisibility(View.GONE);
        }
    });
    animatorSet.start();
}
 
开发者ID:NarendraSickarwar,项目名称:FirebasePost,代码行数:24,代码来源:TakePhotoActivity.java

示例2: animateMenuItemOpen

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
void animateMenuItemOpen(View view,long delay){
    ObjectAnimator animScaleX = ObjectAnimator.ofFloat(view,"scaleX",0.0f,1.0f);
    ObjectAnimator animScaleY = ObjectAnimator.ofFloat(view,"scaleY",0.0f,1.0f);
    ObjectAnimator animAlpha = ObjectAnimator.ofFloat(view,"alpha",0,ITEM_FINAL_ALPHA);
    ObjectAnimator animRotation = ObjectAnimator.ofFloat(view,"rotation",0,360.0f);

    final int X_SCALE_ANIMATION_DURATION = 300;
    final int Y_SCALE_ANIMATION_DURATION = 300;

    animScaleX.setDuration(X_SCALE_ANIMATION_DURATION);
    animScaleY.setDuration(Y_SCALE_ANIMATION_DURATION);

    animRotation.setDuration(200);

    AnimatorSet animSet = new AnimatorSet();
    if(allowItemRotationAnim)
        animSet.playTogether(animScaleX,animScaleY,animAlpha,animRotation);
    else
        animSet.playTogether(animScaleX,animScaleY,animAlpha);
    animSet.setStartDelay(delay);
    animSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animSet.start();
}
 
开发者ID:Modeso,项目名称:ModesoActionOverlay-Android,代码行数:24,代码来源:ProfileAnimatedMenu.java

示例3: rotateFloatingButton

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void rotateFloatingButton(){
    ObjectAnimator animator = isMenuOpen ? ObjectAnimator.ofFloat(mFloatingActionButton
            , "rotation", 45F, 0f) : ObjectAnimator.ofFloat(mFloatingActionButton, "rotation", 0f, 45f);
    animator.setDuration(150);
    animator.setInterpolator(new LinearInterpolator());
    animator.start();
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:8,代码来源:MultiFloatingActionButton.java

示例4: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
    rotateAnim.setDuration(600);
    rotateAnim.setRepeatCount(-1);
    rotateAnim.start();
    animators.add(rotateAnim);
    return animators;
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:11,代码来源:SemiCircleSpinIndicator.java

示例5: hideAddFab

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void hideAddFab() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(mFabAdd, "translationY", SizeUtils.dp2px(80));
    animator.setDuration(150);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mFabAdd.setVisibility(View.GONE);
        }
    });
    animator.start();
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:13,代码来源:NoteMainActivity.java

示例6: animateXY

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * Animates the drawing / rendering of the chart on both x- and y-axis with
 * the specified animation time. If animate(...) is called, no further
 * calling of invalidate() is necessary to refresh the chart.
 *
 * @param durationMillisX
 * @param durationMillisY
 * @param easingX
 * @param easingY
 */
public void animateXY(int durationMillisX, int durationMillisY, EasingFunction easingX,
        EasingFunction easingY) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
    animatorY.setInterpolator(easingY);
    animatorY.setDuration(
            durationMillisY);
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f);
    animatorX.setInterpolator(easingX);
    animatorX.setDuration(
            durationMillisX);

    // make sure only one animator produces update-callbacks (which then
    // call invalidate())
    if (durationMillisX > durationMillisY) {
        animatorX.addUpdateListener(mListener);
    } else {
        animatorY.addUpdateListener(mListener);
    }

    animatorX.start();
    animatorY.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:ChartAnimator.java

示例7: showBottomBar

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void showBottomBar() {
    mRlBottomBar.setVisibility(View.VISIBLE);
    //        bottombar进行一个上移的动画
    ObjectAnimator animator = ObjectAnimator.ofFloat(mRlBottomBar, "translationY", SizeUtils.dp2px(56), 0);
    animator.setDuration(300);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
        }
    });
    animator.start();
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:14,代码来源:NoteMainActivity.java

示例8: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationX",0,360);
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(1500);
    animator.start();
    List<Animator> animators=new ArrayList<>();
    animators.add(animator);
    return animators;
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:13,代码来源:BallPulseRiseIndicator.java

示例9: changeDigit

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void changeDigit(TimelyView tv, int start, int end) {
    try {
        ObjectAnimator obja = tv.animate(start, end);
        obja.setDuration(400);
        obja.start();
    } catch (InvalidParameterException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:10,代码来源:BaseNowplayingFragment.java

示例10: showText

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void showText(TextView textView, String text, int fromColor, int toColor) {
    textView.setText(text);
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(textView, "textColor", fromColor, toColor);
    objectAnimator.setEvaluator(new ArgbEvaluator());
    objectAnimator.setDuration(300);
    objectAnimator.setRepeatCount(0);
    objectAnimator.start();
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:9,代码来源:ShareCard.java

示例11: animateOutlineAlpha

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateOutlineAlpha(final View child, CustomViewOutlineProvider outlineProvider) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(outlineProvider, "alpha", 0, shadowAlpha);
    animator.setDuration(animationDuration);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            child.invalidateOutline();
        }
    });
    animator.start();
}
 
开发者ID:harjot-oberai,项目名称:MaterialShadows,代码行数:12,代码来源:ShadowGenerator.java

示例12: animateY

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * Animates the rendering of the chart on the y-axis with the specified
 * animation time. If animate(...) is called, no further calling of
 * invalidate() is necessary to refresh the chart.
 *
 * @param durationMillis
 */
public void animateY(int durationMillis) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
    animatorY.setDuration(durationMillis);
    animatorY.addUpdateListener(mListener);
    animatorY.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ChartAnimator.java

示例13: 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:Mrqinlei,项目名称:ImitateZHRB,代码行数:14,代码来源:SquareSpinIndicator.java

示例14: createCustomAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void createCustomAnimation() {
    AnimatorSet set = new AnimatorSet();

    ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 1.0f, 0.2f);
    ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 1.0f, 0.2f);

    ObjectAnimator scaleInX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 0.2f, 1.0f);
    ObjectAnimator scaleInY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 0.2f, 1.0f);

    scaleOutX.setDuration(50);
    scaleOutY.setDuration(50);

    scaleInX.setDuration(150);
    scaleInY.setDuration(150);

    scaleInX.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            fabNote.getMenuIconView().setImageResource(fabNote.isOpened() ? R.mipmap.fab_add : R.mipmap.ic_edit);
        }
    });

    set.play(scaleOutX).with(scaleOutY);
    set.play(scaleInX).with(scaleInY).after(scaleOutX);
    set.setInterpolator(new OvershootInterpolator(2));

    fabNote.setIconToggleAnimatorSet(set);
}
 
开发者ID:OlayinkaPeter,项目名称:Toodoo,代码行数:29,代码来源:MainActivity.java

示例15: fadeAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void fadeAnimation(final View v){
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(v, "alpha",  1f, .0f);
    fadeOut.setDuration(500);
    fadeOut.start();
}
 
开发者ID:MFrat,项目名称:CircularReveal,代码行数:6,代码来源:CircularReveal.java


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