當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。