android.view.animation.Transformation.getMatrix()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中android.view.animation.Transformation.getMatrix()方法的一些代码示例,展示了Transformation.getMatrix()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transformation.getMatrix()方法的具体详情如下:
包路径:android.view.animation.Transformation
类名称:Transformation
方法名:getMatrix

Transformation.getMatrix介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    View view = mView.get();
    if (view != null) {
      t.setAlpha(mAlpha);
      transformMatrix(t.getMatrix(), view);
    }
  }
}

代码示例来源:origin: square/assertj-android

public TransformationAssert hasMatrix(Matrix matrix) {
 isNotNull();
 Matrix actualMatrix = actual.getMatrix();
 assertThat(actualMatrix) //
   .overridingErrorMessage("Expected matrix <%s> but was <%s>.", matrix, actualMatrix) //
   .isEqualTo(matrix);
 return this;
}

代码示例来源:origin: JingYeoh/FragmentRigger

@Override
 protected void applyTransformation(float interpolatedTime, Transformation t) {
  Camera camera = new Camera();
  camera.save();

  // 设置camera动作为绕Y轴旋转
  // 总共旋转180度,因此计算在每个补间时间点interpolatedTime的角度即为两着相乘
//    camera.rotateX(deg * interpolatedTime);
  camera.rotateY(180 * interpolatedTime);
//    camera.rotateZ(180 * interpolatedTime);
//
  // 根据camera动作产生一个matrix,赋给Transformation的matrix,以用来设置动画效果
  Matrix matrix = t.getMatrix();
  camera.getMatrix(matrix);

  camera.restore();
  //经过以下平移,才能以view的中心点进行翻转
  matrix.preTranslate(-view.getWidth() / 2, -view.getHeight() / 2);
  matrix.postTranslate(view.getWidth() / 2, view.getHeight() / 2);
 }
}

代码示例来源:origin: Ramotion/folding-cell-android

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  final Camera camera = mCamera;
  final Matrix matrix = t.getMatrix();
  final float fromDegrees = mFromDegrees;
  final float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);
  camera.save();
  camera.rotateX(degrees);
  camera.getMatrix(matrix);
  camera.restore();
  matrix.preTranslate(-mCenterX, -mCenterY);
  matrix.postTranslate(mCenterX, mCenterY);
}

代码示例来源:origin: Yalantis/Side-Menu.Android

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  final float fromDegrees = mFromDegrees;
  float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);
  final float centerX = mCenterX;
  final float centerY = mCenterY;
  final Camera camera = mCamera;
  final Matrix matrix = t.getMatrix();
  camera.save();
  camera.rotateY(degrees);
  camera.getMatrix(matrix);
  camera.restore();
  matrix.preTranslate(-centerX, -centerY);
  matrix.postTranslate(centerX, centerY);
}

代码示例来源:origin: stackoverflow.com

final Matrix matrix = t.getMatrix();
camera.save();
camera.rotateY(degrees);

代码示例来源:origin: JingYeoh/FragmentRigger

@Override
 protected void applyTransformation(float interpolatedTime, Transformation t) {
  final float fromDegrees = mFromDegrees;
  float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

  final float centerX = mCenterX;
  final float centerY = mCenterY;
  final Camera camera = mCamera;
  final Matrix matrix = t.getMatrix();
  camera.save();
  if (mReverse) {
   camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
  } else {
   camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
  }
  camera.rotateY(degrees);
  camera.getMatrix(matrix);
  camera.restore();

  matrix.preTranslate(-centerX, -centerY);
  matrix.postTranslate(centerX, centerY);
 }
}

代码示例来源:origin: stackoverflow.com

Transformation transformation = new Transformation();
float[] matrix = new float[9];
currentAnimation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), transformation);
transformation.getMatrix().getValues(matrix);
float y = matrix[Matrix.MTRANS_Y];

代码示例来源:origin: stackoverflow.com

protected void applyTransformation(float interpolatedTime, Transformation t) {
  if(interpolatedTime == 0){
    t.getMatrix().setTranslate(prevDx, prevDy);
    return;
  t.getMatrix().setTranslate(dx, dy);

代码示例来源:origin: com.nineoldandroids/library

@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    View view = mView.get();
    if (view != null) {
      t.setAlpha(mAlpha);
      transformMatrix(t.getMatrix(), view);
    }
  }
}

代码示例来源:origin: stackoverflow.com

transformation.getMatrix().getValues(matrix);
float y = matrix[Matrix.MTRANS_Y];

代码示例来源:origin: kakajika/FragmentAnimations

protected void applyTransformation(Transformation t) {
  final Matrix m = t.getMatrix();
  final float w = mWidth;
  final float h = mHeight;

代码示例来源:origin: stackoverflow.com

public class myAnimation extends Animation {
 public myAnimation() { }

 @Override
 boolean   willChangeTransformationMatrix() { return true; }

 @Override
 void  applyTransformation(float interpolatedTime, Transformation t) {
  Matrix m = t.getMatrix();
  // do whatever you want to the matrix here, using the interpolatedTime
 }
}

代码示例来源:origin: stackoverflow.com

private class MyAnimation extends Animation {
  private Matrix matrix;

  public MyAnimation(Matrix matrix) {
    this.matrix = matrix;
  }

  @Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    super.applyTransformation(interpolatedTime, t);
    t.getMatrix().set(matrix);
  }
}

代码示例来源:origin: hiteshsahu/ECommerce-App-Android

protected void applyTransformation(float interpolatedTime, Transformation t) {
    Matrix tran = t.getMatrix();
    tran.postTranslate(_offsetx, _offsety);
    tran.postRotate(_angel, _anchorx, _anchory);
  }
};

代码示例来源:origin: stackoverflow.com

protected boolean getChildStaticTransformation(View child, Transformation t) {
  t.clear();
  t.setTransformationType(Transformation.TYPE_MATRIX);
  final Matrix matrix = t.getMatrix();
  float childCenterPos = child.getLeft() + (child.getWidth() / 2f);
  float center = getWidth() / 2;
  float diff = Math.abs(center - childCenterPos);
  float scale = diff / getWidth();

  matrix.setScale(1 - (scale), 1 - (scale));

  return true;
}

代码示例来源:origin: stackoverflow.com

Transformation outTransformation = new Transformation();
myAnimation.getTransformation(currentTime, outTransformation);
Matrix transformationMatrix = outTransformation.getMatrix();
float[] matrixValues = new float[9];
transformationMatrix.getValues(matrixValues);
float transX = matrixValues[Matrix.MTRANS_X];
float transY = matrixValues[Matrix.MTRANS_Y];

代码示例来源:origin: Jaouan/Revealator

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  final float dx = calculateBezier(interpolatedTime, mStart.x, mControl.x, mEnd.x);
  final float dy = calculateBezier(interpolatedTime, mStart.y, mControl.y, mEnd.y);
  t.getMatrix().setTranslate(dx, dy);
}

代码示例来源:origin: Janseon/CardMenuView

@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
  if (mTransformView == child && applyTransformation()) {
    canvas.save();
    canvas.concat(mTransformation.getMatrix());
    canvas.setDrawFilter(mPaintFlagsDrawFilter);
    boolean drawChild = super.drawChild(canvas, child, drawingTime);
    canvas.restore();
    return drawChild;
  }
  return super.drawChild(canvas, child, drawingTime);
}

代码示例来源:origin: binaryroot/CarouselView

private final Matrix getChildTransformationMatrix(final CarouselItemHolder item,
    final Transformation transformation) {
  float scale = item.getItemScale();
  float scaleXOff = item.getWidth() / 2.0f * (1.0f - scale);
  float centerX = (float) getWidth() / 2;
  scaleXOff += (item.getItemX() + item.getWidth() / 2 - centerX)
      * mViewCoefficientHolder.mDiameterScale;
  final Matrix matrix = transformation.getMatrix();
  matrix.setTranslate(item.getItemX() + scaleXOff, item.getItemY());
  matrix.preScale(scale, scale);
  return matrix;
}

相关文章