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; }
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; }
@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; }
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; }
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; }
t.setTransformationType(Transformation.TYPE_MATRIX); final Matrix m = t.getMatrix(); m.setScale(this.sf, this.sf);
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; } }
setStaticTransformationsEnabled(true); mTransformation = new Transformation(); mTransformation.setTransformationType(Transformation.TYPE_MATRIX); } else { mTransformation = null;
t.setTransformationType(Transformation.TYPE_BOTH);
t.setTransformationType(Transformation.TYPE_BOTH);
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; }
transformation.setTransformationType(Transformation.TYPE_MATRIX);
if (overscrollEffect.isOverScrolling() && isFirstOrLast) { t.clear(); t.setTransformationType(Transformation.TYPE_MATRIX);