[Java] Android Gallery实现3D相册(附效果图+Demo源码) →→→→→进入此内容的聊天室

来自 , 2021-01-28, 写在 Java, 查看 149 次.
URL http://www.code666.cn/view/20b5e1cf
  1. protected boolean getChildStaticTransformation(View child, Transformation trans)  
  2.     { //图像的中心点和宽度
  3.         final int childCenter = getCenterOfView(child);
  4.         final int childWidth = child.getWidth();
  5.         int rotationAngle = 0;
  6.  
  7.         trans.clear();
  8.         trans.setTransformationType(Transformation.TYPE_BOTH);        // alpha 和 matrix 都变换
  9.  
  10.         if (childCenter == mCoveflowCenter)  
  11.         {      // 正中间的childView
  12.             transformImageBitmap((ImageView) child, trans, 0);    
  13.         }  
  14.         else  
  15.         {          // 两侧的childView
  16.             rotationAngle = (int) ( ( (float) (mCoveflowCenter - childCenter) / childWidth ) * mMaxRotationAngle );
  17.             if (Math.abs(rotationAngle) > mMaxRotationAngle)  
  18.             {
  19.                 rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
  20.             } //根据偏移角度对图片进行处理,看上去有3D的效果。
  21.             transformImageBitmap((ImageView) child, trans, rotationAngle);
  22.         }
  23.  
  24.         return true;
  25.     }

回复 "Android Gallery实现3D相册(附效果图+Demo源码)"

这儿你可以回复上面这条便签

captcha