當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueAnimator.setInterpolator方法代碼示例

本文整理匯總了Java中android.animation.ValueAnimator.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.setInterpolator方法的具體用法?Java ValueAnimator.setInterpolator怎麽用?Java ValueAnimator.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.setInterpolator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: endAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.25f, getWidth());
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:19,代碼來源:SnowType.java

示例2: endAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);

    ValueAnimator animator1 = ValueAnimator.ofFloat(1, 0);
    animator1.setInterpolator(new AccelerateInterpolator());
    animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            speed = (float) animation.getAnimatedValue() * 32;
            rotate = (float) animation.getAnimatedValue();
        }
    });

    AnimatorSet animSet = new AnimatorSet();
    animSet.play(animator1);
    animSet.setDuration(1000);
    if (listener != null) {
        animSet.addListener(listener);
    }
    animSet.start();
}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:23,代碼來源:HazeType.java

示例3: start

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void start() {
    if (!isEnableAnim) { // 禁止動畫
        setText(mPrefixString + format(new BigDecimal(mNumEnd)) + mPostfixString);
        return;
    }
    ValueAnimator animator = ValueAnimator.ofObject(new BigDecimalEvaluator(), new BigDecimal(mNumStart), new BigDecimal(mNumEnd));
    animator.setDuration(mDuration);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            BigDecimal value = (BigDecimal) valueAnimator.getAnimatedValue();
            setText(mPrefixString + format(value) + mPostfixString);
        }
    });
    animator.start();
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:18,代碼來源:NumberAnimTextView.java

示例4: onFling

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    if (mBoundWidth * scale > getWidth()) {
        float sx = translateLeft + (1f / 2f) * velocityX * 0.5f * 0.5f;
        sx = getExplicitTranslateLeft(sx);
        ValueAnimator mResetXAnimator = getResetXAnimator();
        mResetXAnimator.setDuration(300);
        mResetXAnimator.setInterpolator(mDecInterpolator);
        mResetXAnimator.setFloatValues(translateLeft, sx);
        mResetXAnimator.addUpdateListener(getOnTranslateXAnimationUpdate());
        mResetXAnimator.start();
    }

    if (mBoundHeight * scale > getHeight()) {
        float sy = translateTop + (1f / 2f) * velocityY * 0.5f * 0.5f;
        sy = getExplicitTranslateTop(sy);
        ValueAnimator mResetYAnimator = getResetYAnimator();
        mResetYAnimator.setDuration(300);
        mResetYAnimator.setInterpolator(mDecInterpolator);
        mResetYAnimator.setFloatValues(translateTop, sy);
        mResetYAnimator.addUpdateListener(getOnTranslateYAnimationUpdate());
        mResetYAnimator.start();
    }

    return true;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:27,代碼來源:ImagePreviewView.java

示例5: startAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
    super.startAnimation(dynamicWeatherView, fromColor);
    ValueAnimator animator1 = ValueAnimator.ofFloat(0, 1);
    animator1.setInterpolator(new OvershootInterpolator());
    animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            speed = (float) animation.getAnimatedValue() * 32;
            rotate = (float) animation.getAnimatedValue();
        }
    });

    AnimatorSet animSet = new AnimatorSet();
    animSet.play(animator1);
    animSet.setDuration(1000);
    animSet.start();

}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:20,代碼來源:HazeType.java

示例6: runButtonAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void runButtonAnimation(){
    next.setScaleX(0);next.setScaleY(0);
    prev.setScaleX(0);prev.setScaleY(0);
    Path arcPath=createArcPath(playPause,0,0,-playPause.getTranslationY());
    ValueAnimator pathAnimator=ValueAnimator.ofFloat(0,1);
    pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        private float point[] = new float[2];
        private PathMeasure pathMeasure = new PathMeasure(arcPath, false);

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final float value = animation.getAnimatedFraction();
            // Gets the point at the fractional path length
            pathMeasure.getPosTan(pathMeasure.getLength() * value, point, null);

            // Sets view location to the above point
            playPause.setTranslationX(point[0]);
            playPause.setTranslationY(point[1]);
        }
    });
    pathAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    pathAnimator.setDuration(duration(R.integer.path_duration)/2);
    pathAnimator.start();
    next.animate()
            .setDuration(duration(R.integer.scale_duration))
            .setStartDelay(duration(R.integer.short_delay))
            .scaleX(1).scaleY(1)
            .start();
    prev.animate()
            .setDuration(duration(R.integer.scale_duration))
            .setStartDelay(duration(R.integer.short_delay))
            .scaleX(1).scaleY(1)
            .start();
}
 
開發者ID:vpaliyX,項目名稱:Material-Motion,代碼行數:35,代碼來源:PlayerFragment.java

示例7: createCosinusValueAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public static ValueAnimator createCosinusValueAnimator(final float start, final float end, final CosinusAnimatorUpdateListener listener) {
  ValueAnimator valueAnimator = ValueAnimator.ofFloat((float) (-Math.PI), (float) (Math.PI));
  valueAnimator.setInterpolator(new LinearInterpolator());
  if (listener != null) {
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override public void onAnimationUpdate(ValueAnimator animation) {
        double offset = (Math.cos((float) animation.getAnimatedValue()) + 1) / 2;
        float value = (float) (start + (end - start) * offset);
        listener.onCosinusAnimatorUpdate(value);
      }
    });
  }
  return valueAnimator;
}
 
開發者ID:tommybuonomo,項目名稱:materialsquareloading,代碼行數:15,代碼來源:MaterialSquareLoading.java

示例8: startAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startAnimation() {
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, zhuValue);
    valueAnimator.setInterpolator(new BounceInterpolator());
    valueAnimator.setDuration(2000);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            zValue = (Float) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    valueAnimator.start();
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:14,代碼來源:MatchTechniqueView.java

示例9: flipAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private static ValueAnimator flipAnimator(boolean isFlipped, final View v) {
    ValueAnimator animator = ValueAnimator.ofFloat(isFlipped ? -1f : 1f, isFlipped ? 1f : -1f);
    animator.setInterpolator(new FastOutSlowInInterpolator());

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            //Update Height
            v.setScaleY((Float) valueAnimator.getAnimatedValue());
        }
    });
    return animator;
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:14,代碼來源:MainActivity.java

示例10: startHideAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startHideAnimation() {
    //Start the Handler to clean up the Alert
    if (!enableInfiniteDuration) {
        runningAnimation = new Runnable() {
            @Override
            public void run() {
                hide();
            }
        };
        postDelayed(runningAnimation, duration);
    }

    if (enableProgress && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        pbProgress.setVisibility(View.VISIBLE);

        final ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100);
        valueAnimator.setDuration(getDuration());
        valueAnimator.setInterpolator(new LinearInterpolator());
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(final ValueAnimator animation) {
                getProgressBar().setProgress((int) animation.getAnimatedValue());
            }
        });
        valueAnimator.start();
    }

}
 
開發者ID:Tapadoo,項目名稱:Alerter,代碼行數:30,代碼來源:Alert.java

示例11: initAnimatior

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private ValueAnimator initAnimatior(final ProgressBean pb) {
    Interpolator pathInterpolatorCompat = PathInterpolatorCompat.create(0.7f, 0f, 0.3f, 1f);
    ValueAnimator mAnimator = ValueAnimator.ofInt(0, 359);
    mAnimator.setDuration(pb.getDuration());
    mAnimator.setInterpolator(pathInterpolatorCompat);
    mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.d("dur", animation.getAnimatedValue() + "====" + pb.getmBallRadius());
            pb.setmCurrentAngle((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    return mAnimator;
}
 
開發者ID:yanyiqun001,項目名稱:goRefresh,代碼行數:16,代碼來源:MulRingProgressBar.java

示例12: hide

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void hide() {
    ValueAnimator animator = ValueAnimator.ofFloat(mBottomView.getY(), mOriginalY + mBottomView.getHeight());
    animator.setDuration(getDuration());
    animator.setInterpolator(getInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mBottomView.setY((Float) valueAnimator.getAnimatedValue());
        }
    });
    animator.start();
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:14,代碼來源:BottomBehaviorAnim.java

示例13: onCustomProperty

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@OnClick(R.id.customProperty)
public void onCustomProperty() {
    ValueAnimator animator = ObjectAnimator.ofFloat(fancyIcon, "translationXY", fancyIcon.getTranslationXY(), animateForward ? -fancyIcon.getWidth() * 2 : 0.0f);
    animator.setDuration(FULL_ANIMATION_DURATION);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
    animateForward = !animateForward;
}
 
開發者ID:zawadz88,項目名稱:AnimationShowcase,代碼行數:9,代碼來源:ObjectAnimatorActivity.java

示例14: createAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * 創建回彈動畫
 * 上圓半徑減速恢複至最大半徑
 * 下圓半徑減速恢複至最大半徑
 * 圓心距減速從最大值減到0(下圓Y從當前位置移動到上圓Y)。
 */
public Animator createAnimator() {
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1, 0.001f).setDuration(BACK_ANIM_DURATION);
    valueAnimator.setInterpolator(new DecelerateInterpolator());
    valueAnimator.addUpdateListener(valueAnimator1 -> {
        updateComleteState((float) valueAnimator1.getAnimatedValue());
        postInvalidate();
    });
    return valueAnimator;
}
 
開發者ID:Brave-wan,項目名稱:SmartRefresh,代碼行數:16,代碼來源:WaterDropView.java

示例15: startAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
    super.startAnimation(dynamicWeatherView, fromColor);
    this.dynamicWeatherView = dynamicWeatherView;
    ValueAnimator animator = ValueAnimator.ofFloat(-bitmap.getWidth() * 0.2f, getWidth() - bitmap.getWidth() * 0.2f);
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new OvershootInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });

    animator.start();

    flashRunnable = new Runnable() {
        @Override
        public void run() {
            ValueAnimator animator2 = ValueAnimator.ofFloat(0, 1);
            animator2.setDuration(500);
            animator2.setRepeatCount(0);
            animator2.setInterpolator(new DecelerateInterpolator());
            animator2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    mAnimatorValue = (float) animation.getAnimatedValue();
                }
            });
            animator2.start();
            dynamicWeatherView.postDelayed(flashRunnable, 5000);
        }
    };
    dynamicWeatherView.post(flashRunnable);
}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:37,代碼來源:RainType.java


注:本文中的android.animation.ValueAnimator.setInterpolator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。