本文整理汇总了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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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;
}