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


Java ValueAnimator.ofPropertyValuesHolder方法代碼示例

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


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

示例1: onFling

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
	if (mode == DRAG) {
		if (flingDuration > 0 && !isAnimating()) {
			float factor = ((float) flingDuration / 1000f) * flingExaggeration;
			float[] values = corrector.getValues();
			float dx = (velocityX * factor) * values[Matrix.MSCALE_X];
			float dy = (velocityY * factor) * values[Matrix.MSCALE_Y];
			PropertyValuesHolder flingX = PropertyValuesHolder.ofFloat(FlingAnimatorHandler.PROPERTY_TRANSLATE_X, values[Matrix.MTRANS_X], values[Matrix.MTRANS_X] + dx);
			PropertyValuesHolder flingY = PropertyValuesHolder.ofFloat(FlingAnimatorHandler.PROPERTY_TRANSLATE_Y, values[Matrix.MTRANS_Y], values[Matrix.MTRANS_Y] + dy);
			valueAnimator = ValueAnimator.ofPropertyValuesHolder(flingX, flingY);
			valueAnimator.setDuration(flingDuration);
			valueAnimator.addUpdateListener(new FlingAnimatorHandler(corrector));
			valueAnimator.setInterpolator(new DecelerateInterpolator());
			valueAnimator.start();
			return true;
		}
	}
	return super.onFling(e1, e2, velocityX, velocityY);
}
 
開發者ID:martinwithaar,項目名稱:PinchToZoom,代碼行數:21,代碼來源:ImageMatrixTouchHandler.java

示例2: createBackAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void createBackAnimator(
        float xStart,
        float xEnd,
        float distanceXStart,
        float distanceXEnd,
        float fractionXStart,
        float fractionXEnd) {
    mBackAnimator = new ValueAnimator();
    mXHolder = PropertyValuesHolder.ofFloat(mXHolderName, xStart, xEnd);
    mDistanceXHolder = PropertyValuesHolder.ofFloat(mDistanceXHolderName, distanceXStart, distanceXEnd);
    mFractionXHolder = PropertyValuesHolder.ofFloat(mFractionXHolderName, fractionXStart, fractionXEnd);

    mBackAnimator = ValueAnimator.ofPropertyValuesHolder(
            mXHolder,
            //        mYHolder,
            mDistanceXHolder,
            //        mDistanceYHolder
            mFractionXHolder
            //        mFractionYHolder
    );
    mBackAnimator.setDuration(mAnimationBackDuration);
    mBackAnimator.setInterpolator(mBackAnimInterpolator);
    mBackAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float x = (float) valueAnimator.getAnimatedValue(mXHolderName);
            float distanceX = (float) valueAnimator.getAnimatedValue(mDistanceXHolderName);
            float fractionX = (float) valueAnimator.getAnimatedValue(mFractionXHolderName);

            handleListeners(x, distanceX, fractionX);
        }
    });
}
 
開發者ID:anmingyu11,項目名稱:SwipeBackController,代碼行數:34,代碼來源:SwipeBackController.java

示例3: createOutAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void createOutAnimator(
        float xStart,
        float xEnd,
        float distanceXStart,
        float distanceXEnd,
        float fractionXStart,
        float fractionXEnd) {
    mOutAnimator = new ValueAnimator();
    mXHolder = PropertyValuesHolder.ofFloat(mXHolderName, xStart, xEnd);
    mDistanceXHolder = PropertyValuesHolder.ofFloat(mDistanceXHolderName, distanceXStart, distanceXEnd);
    mFractionXHolder = PropertyValuesHolder.ofFloat(mFractionXHolderName, fractionXStart, fractionXEnd);
    mOutAnimator = ValueAnimator.ofPropertyValuesHolder(
            mXHolder,
            //mYHolder,
            mDistanceXHolder,
            //mDistanceYHolder,
            mFractionXHolder
            //mFractionYHolder
    );
    mOutAnimator.setDuration(mAnimationOutDuration);
    mOutAnimator.setInterpolator(mOutAnimInterpolator);
    mOutAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float x = (float) valueAnimator.getAnimatedValue(mXHolderName);
            float distanceX = (float) valueAnimator.getAnimatedValue(mDistanceXHolderName);
            float fractionX = (float) valueAnimator.getAnimatedValue(mFractionXHolderName);

            handleListeners(x, distanceX, fractionX);
        }
    });
}
 
開發者ID:anmingyu11,項目名稱:SwipeBackController,代碼行數:33,代碼來源:SwipeBackController.java

示例4: createLaunchAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private ValueAnimator createLaunchAnim(float startRawX, float startRawY, float endRawX, float endRawY) {
    PropertyValuesHolder xPro = PropertyValuesHolder.ofFloat("x_path", startRawX, endRawX);
    PropertyValuesHolder yPro = PropertyValuesHolder.ofFloat("y_path", startRawY, endRawY);
    ValueAnimator anim = ValueAnimator.ofPropertyValuesHolder(xPro, yPro);
    anim.setDuration(250);
    return anim;
}
 
開發者ID:halohoop,項目名稱:UsoppBubble,代碼行數:8,代碼來源:UsoppFrameLayout.java


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