当前位置: 首页>>代码示例>>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;未经允许,请勿转载。