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


Java Animator.setDuration方法代码示例

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


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

示例1: concealActivity

import android.animation.Animator; //导入方法依赖的package包/类
public static void concealActivity(final Activity activity, final int duration, final int centerX, int centerY) {
    if (takeEffect) {
        final View rootView = activity.findViewById(android.R.id.content);
        Animator animator = ViewAnimationUtils.createCircularReveal(rootView, centerX, centerY, getMaxRadius(rootView) * 2, 0);
        animator.setDuration(duration);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                rootView.setVisibility(View.GONE);
                activity.finish();
                activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        });
        animator.start();
    } else {
        activity.finish();
    }
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:19,代码来源:RevealUtil.java

示例2: show

import android.animation.Animator; //导入方法依赖的package包/类
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:CircularAnimUtil.java

示例3: startTranslationYAnimation

import android.animation.Animator; //导入方法依赖的package包/类
public static void startTranslationYAnimation(View view, long delay, long duration,
        float endTranslationY, Interpolator interpolator) {
    Animator translationAnim;
    if (view.isHardwareAccelerated() && isSupportRenderNodeAnimator()) {
        RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(
                RenderNodeAnimator.TRANSLATION_Y, endTranslationY);
        translationAnimRt.setTarget(view);
        translationAnim = translationAnimRt;
    } else {
        translationAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
                view.getTranslationY(), endTranslationY);
    }
    translationAnim.setInterpolator(interpolator);
    translationAnim.setDuration(duration);
    translationAnim.setStartDelay(delay);
    translationAnim.start();
}
 
开发者ID:Trumeet,项目名称:Animations,代码行数:18,代码来源:AppearAnimationUtils.java

示例4: doCircularExitAnimation

import android.animation.Animator; //导入方法依赖的package包/类
/**
 * Circular reveal exit animation
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doCircularExitAnimation() {
    final int revealRadius = (int) Math.hypot(getWidth(), getHeight());
    Animator exitAnimator = ViewAnimationUtils.createCircularReveal(this,
            mCenterX, mCenterY, revealRadius, 0f);
    exitAnimator.setDuration(mAnimationDuration);
    exitAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
            android.R.interpolator.decelerate_cubic));
    exitAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            removeView();

        }
    });
    exitAnimator.start();


}
 
开发者ID:mengcuiguang,项目名称:FancyShowCaseView-master,代码行数:23,代码来源:FancyShowCaseView.java

示例5: snapChild

import android.animation.Animator; //导入方法依赖的package包/类
private void snapChild(final View animView, final float targetLeft, float velocity) {
    final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
    AnimatorUpdateListener updateListener = new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            onTranslationUpdate(animView, (float) animation.getAnimatedValue(), canBeDismissed);
        }
    };

    Animator anim = getViewTranslationAnimator(animView, targetLeft, updateListener);
    if (anim == null) {
        return;
    }
    int duration = SNAP_ANIM_LEN;
    anim.setDuration(duration);
    anim.addListener(new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator animator) {
            mSnappingChild = false;
            updateSwipeProgressFromOffset(animView, canBeDismissed);
            mCallback.onChildSnappedBack(animView, targetLeft);
        }
    });
    prepareSnapBackAnimation(animView, anim);
    mSnappingChild = true;
    anim.start();
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:26,代码来源:SwipeHelper.java

示例6: hideView

import android.animation.Animator; //导入方法依赖的package包/类
private void hideView() {
    final Pair<Float, Float> center = ViewUtils.getCenter(revealImage);
    final Animator animator = ViewAnimationUtils.createCircularReveal(toolbarImageView,
            center.first.intValue(), center.second.intValue(), toolbarImageView.getWidth(), 0);
    animator.setDuration(TRANSITION_DURATION);
    animator.start();
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:8,代码来源:GeraltWomanActivity.java

示例7: createAnimator

import android.animation.Animator; //导入方法依赖的package包/类
@Override
    public Animator createAnimator(final ViewGroup sceneRoot,
                                   TransitionValues startValues,
                                   final TransitionValues endValues) {

        Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
        if (startValues == null || endValues == null || changeBounds == null)
            return null;

//        if (endValues.view instanceof ViewGroup) {
//            ViewGroup vg = (ViewGroup) endValues.view;
//            float offset = vg.getHeight() / 3;
//            for (int i = 0; i < vg.getChildCount(); i++) {
//                View v = vg.getChildAt(i);
//                v.setTranslationY(offset);
//                v.setAlpha(0f);
//                v.animate()
//                        .alpha(1f)
//                        .translationY(0f)
//                        .setDuration(150)
//                        .setStartDelay(150)
//                        .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
//                                android.R.interpolator.fast_out_slow_in));
//                offset *= 1.8f;
//            }
//        }

        changeBounds.setDuration(500);
        changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
                android.R.interpolator.fast_out_slow_in));
        return changeBounds;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:CustomChangeBounds.java

示例8: onPreDraw

import android.animation.Animator; //导入方法依赖的package包/类
@Override
@TargetApi(VERSION_CODES.LOLLIPOP)
public boolean onPreDraw() {
  heart.getViewTreeObserver().removeOnPreDrawListener(this);
  final int w = heart.getWidth();
  final int h = heart.getHeight();
  Animator reveal = ViewAnimationUtils.createCircularReveal(heart,
                                                            w / 2, h,
                                                            0, (float)Math.sqrt(h*h + (w*w/4)));
  reveal.setInterpolator(new FastOutSlowInInterpolator());
  reveal.setDuration(800);
  reveal.start();
  return false;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:15,代码来源:InviteActivity.java

示例9: hide

import android.animation.Animator; //导入方法依赖的package包/类
/**
 * 由满向中间收缩,直到隐藏。
 */
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.INVISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;
    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
    anim.setDuration(durationMills);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    anim.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:CircularAnimUtil.java

示例10: setSpeed

import android.animation.Animator; //导入方法依赖的package包/类
/**
 * 设置每个动画对应的持续时间
 *
 * @param speed
 */
public void setSpeed(int speed) {
    mSpeed = speed;
    List<Animator> listAnimator = mAnimatorSet.getChildAnimations();
    for (int i = 0; i < listAnimator.size(); i++) {
        Animator a = listAnimator.get(i);
        a.setDuration(parseSpeed(pathDistances.get(i)));
    }
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:14,代码来源:MovingViewAnimator.java

示例11: setDuration

import android.animation.Animator; //导入方法依赖的package包/类
@Override
public void setDuration(int duration) {
    Animator a = mAnimator.get();
    if(a != null) {
        a.setDuration(duration);
    }
}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:8,代码来源:SupportAnimatorLollipop.java

示例12: animateButton

import android.animation.Animator; //导入方法依赖的package包/类
private void animateButton() {
    /* Circular reveal the button */
    int startRadius = 0;
    int finalRadius = Math.max(maskView.getHeight(), maskView.getWidth());
    final Animator anim = ViewAnimationUtils.createCircularReveal(maskView,
            maskView.getRight(),
            maskView.getHeight() / 2
            , startRadius, finalRadius);
    maskView.setVisibility(View.VISIBLE);
    anim.setInterpolator(new FastOutSlowInInterpolator());
    anim.setDuration(800);
    anim.start();

    // set the button text2+
    buttonText.setText(R.string.continue_btn_text);

    /* Animate the check image */
    ObjectAnimator rotationAnimator = ObjectAnimator.ofFloat(checkImage, "rotation", 0f, 360f);
    rotationAnimator.setDuration(400);
    rotationAnimator.setInterpolator(new FastOutSlowInInterpolator());

    int center = maskView.getRight() / 2;
    int right = maskView.getRight();
    int offSet = (right - center) / 2;
    ObjectAnimator translateXInterpolator = ObjectAnimator.ofFloat(checkImage, "x", offSet + 10f);
    translateXInterpolator.setDuration(400);
    translateXInterpolator.setInterpolator(new DecelerateInterpolator());

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(rotationAnimator, translateXInterpolator);
    animatorSet.start();

    // for second time
    count++;
}
 
开发者ID:rumaan,项目名称:AcademApp,代码行数:36,代码来源:UserDetailsActivity.java

示例13: createRevealAnimator

import android.animation.Animator; //导入方法依赖的package包/类
private Animator createRevealAnimator(FloatingActionButton dot, float offsetY){
    ViewCompat.setElevation(dot,0);
    dot.setVisibility(View.INVISIBLE);
    lastDot=dot;
    int cx=(int)(dot.getX()+dot.getHeight()/2);
    int cy=(int)(dot.getY()+dot.getHeight()/2+offsetY);
    int w = topPanel.getWidth();
    int h = topPanel.getHeight();
    final int endRadius = !isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    final int startRadius=isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    topPanel.setVisibility(View.VISIBLE);
    Animator animator= ViewAnimationUtils.createCircularReveal(topPanel,cx,cy,startRadius,endRadius);
    animator.setDuration(duration(R.integer.reveal_duration));
    return animator;
}
 
开发者ID:vpaliyX,项目名称:Material-Motion,代码行数:16,代码来源:DotsFragment.java

示例14: hideMenu

import android.animation.Animator; //导入方法依赖的package包/类
private void hideMenu(int cx, int cy, float startRadius, float endRadius) {
  List<Animator> animList = new ArrayList<>();

  for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
    animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
  }

  animList.add(createHideItemAnimator(centerItem));

  Animator revealAnim = createCircularReveal(menuLayout, cx, cy, startRadius, endRadius);
  revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
  revealAnim.setDuration(200);
  revealAnim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      menuLayout.setVisibility(View.INVISIBLE);
    }
  });

  animList.add(revealAnim);

  AnimatorSet animSet = new AnimatorSet();
  animSet.playSequentially(animList);
  animSet.start();

}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:28,代码来源:DemoLikeTumblrActivity.java

示例15: showTop

import android.animation.Animator; //导入方法依赖的package包/类
private void showTop(View view) {
    view.setVisibility(View.VISIBLE);
    Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, -view.getHeight(), 0f));
    iconAnim.setDuration(VIEW_ANIMATION);
    iconAnim.start();


}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:10,代码来源:SearchPlaceActivity.java


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