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

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

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

Transformation.setTransformationType介绍

暂无

代码示例

代码示例来源: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

protected boolean getChildStaticTransformation(View child, Transformation t) {
       child.invalidate(); // add this line
       final int childCenter = getCenterOfView(child);
       final int childWidth = child.getWidth();
       int rotationAngle = 0;
       t.clear();
       t.setTransformationType(Transformation.TYPE_MATRIX);
       if (childCenter == mCoveflowCenter) {
           transformImageBitmap((ImageView) child, t, 0); 
       } else {
           rotationAngle = (int) (((float) (mCoveflowCenter - childCenter) / childWidth) * mMaxRotationAngle);
           if (Math.abs(rotationAngle) > mMaxRotationAngle) {
               rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle
                       : mMaxRotationAngle;
           }   
           transformImageBitmap((ImageView) child, t, rotationAngle);
       }   
       return true;
   }

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

@Override
 protected boolean getChildStaticTransformation(View child, Transformation t) {
   Matrix matrix = t.getMatrix();
     int centerX = (child.getWidth() / 2);
     int centerY = (child.getHeight() / 2);
   t.clear();
   t.setTransformationType(Transformation.TYPE_MATRIX);
   mCamera.save();
   if (child == getChildAt(0)) {
     mCamera.translate(pixels to the right,pixels to the bottom,
         to the z axis);
     mCamera.getMatrix(matrix);
     mCamera.restore();
     matrix.preTranslate(-centerX, -centerY);
     matrix.postTranslate(centerX, centerY);
   } 
   return true;
 }

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

private final Transformation mTransformation;

public ListView3d(Context context, AttributeSet attrs) {
  super(context, attrs);
  if (!isInEditMode()) {
    setStaticTransformationsEnabled(true);
    mTransformation = new Transformation();
    mTransformation.setTransformationType(Transformation.TYPE_MATRIX);
  } else {
    mTransformation = null;
  }       
}

@Override
protected boolean getChildStaticTransformation(View child, Transformation t) {
  mTransformation.getMatrix().reset();
  final int childTop = Math.max(0,child.getTop());
  final int parentHeight = getHeight();
  final float scale = (float)(parentHeight-(childTop/2))/getHeight();
  Log.i("scale",scale+"");
  final float px = child.getLeft() + (child.getWidth()) / 2;
  final float py = child.getTop() + (child.getHeight()) / 2;
  mTransformation.getMatrix().postScale(scale, scale, px, py);
  t.compose(mTransformation);
  return true;
}

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

protected boolean getChildStaticTransformation
  (View child, Transformation transformation) {

  transformation.clear();
  transformation.setTransformationType(Transformation.TYPE_MATRIX);

  // Center of the item
  float centerX = (float)child.getWidth()/2, centerY = (float)child.getHeight()/2;

  // Save camera
  mCamera.save();

  // Translate the item to it's coordinates
  final Matrix matrix = transformation.getMatrix();
  mCamera.translate(((CarouselImageView)child).getX(), 
        ((CarouselImageView)child).getY(), 
        ((CarouselImageView)child).getZ());

  // Align the item
  mCamera.getMatrix(matrix);
  matrix.preTranslate(-centerX, -centerY);
  matrix.postTranslate(centerX, centerY);

  // Restore camera
  mCamera.restore();      

  return true;
}

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

t.setTransformationType(Transformation.TYPE_MATRIX);
final Matrix m = t.getMatrix();
m.setScale(this.sf, this.sf);

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

public class MyRelativeLayout extends RelativeLayout {    
  public MyRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    init();
  }

  public MyRelativeLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
  }

  public MyRelativeLayout(Context context) {
    super(context);
    init();
  }

  private void init() {
    setStaticTransformationsEnabled(true);
  }

  @Override
  protected boolean getChildStaticTransformation(View child, Transformation t) {
    t.setTransformationType(Transformation.TYPE_MATRIX);
    Matrix m = t.getMatrix();
    m.reset();
    m.postRotate(180, child.getWidth() / 2.0f, child.getHeight() / 2.0f);
    return true;
  }
}

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

setStaticTransformationsEnabled(true);
  mTransformation = new Transformation();
  mTransformation.setTransformationType(Transformation.TYPE_MATRIX);
} else {
  mTransformation = null;

代码示例来源:origin: xingkongus/superXingPostCard

t.setTransformationType(Transformation.TYPE_BOTH);

代码示例来源:origin: iamvaliyev/MultiTabMenu

t.setTransformationType(Transformation.TYPE_BOTH);

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

private boolean applyTransformation() {
  mTransformation.clear();
  mTransformation.setTransformationType(Transformation.TYPE_MATRIX);
  final Matrix matrix = mTransformation.getMatrix();
  final int layoutHeight = getHeight();
  final int currY = getScrollY();
  final float effectsAmount = currY / (float) layoutHeight;
  if (effectsAmount == 0f) {
    return false;
  }
  float degrees = maxRotation * effectsAmount;
  final Camera camera = mCamera;
  camera.save();
  camera.rotateX(degrees);
  camera.getMatrix(matrix);
  camera.restore();
  final float centerX = getWidth() / 2;
  matrix.preTranslate(-centerX, 0);
  matrix.postTranslate(centerX, 0);
  return true;
}

代码示例来源:origin: dalong982242260/CarrouselView

transformation.setTransformationType(Transformation.TYPE_MATRIX);

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

if (overscrollEffect.isOverScrolling() && isFirstOrLast) {
  t.clear();
  t.setTransformationType(Transformation.TYPE_MATRIX);

相关文章