使用camera、matrix仿即刻APP换一换
来源:互联网 发布:控制台运行java程序 编辑:程序博客网 时间:2024/05/01 06:51
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //画当前图片 camera.save(); camera.rotateX(0); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-width, 0); matrix.postTranslate(width, offsetY); canvas.drawBitmap(currentBitmap, matrix, null); //画下一张图片 camera.save(); camera.rotateX(0); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-width , -height); matrix.postTranslate(width, offsetY); canvas.drawBitmap(nextBitmap, matrix, null); }
图片缩放
private Bitmap scaleBitmap(Bitmap bitmap) { int originHeight = bitmap.getHeight(); Log.d("originHeight", originHeight + ""); int originWidth = bitmap.getWidth(); float scaleWidth = ((float) width)/ originWidth; float scaleHeight = ((float) height)/ originHeight; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); return Bitmap.createBitmap(bitmap, 0, 0, originWidth, originHeight, matrix, false); }
属性动画
public void changePic(Bitmap bitmap) { currentBitmap = nextBitmap; nextBitmap = scaleBitmap(bitmap); ValueAnimator animator = ObjectAnimator.ofFloat(0, height); animator.setDuration(1000); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { offsetY = (float) animation.getAnimatedValue(); postInvalidate(); } }); animator.start(); }
0 0
- 使用camera、matrix仿即刻APP换一换
- Android仿即刻APP点赞桃心的效果
- 仿即刻APP点赞桃心的效果
- 自定义view 仿即刻APP炫酷的点赞效果
- 60.自定义View练习(五)高仿小米时钟 - 使用Camera和Matrix实现3D效果
- 即刻App产品分析报告
- 爬取‘即刻’APP数据
- android使用camera和matrix,canvas小结
- Matrix与graphics.Camera的使用
- 自定义View-仿即刻点赞效果
- 即刻app 点赞效果实现
- 使用TextureView setTransform(Matrix)方法,解决Camera显示变形问题
- 使用Camera和Matrix实现3D效果
- 使用TextureView setTransform(Matrix)方法,解决Camera显示变形问题
- 手摸手教你写炫酷控件(仿即刻首页滚动效果)
- 仿即刻点赞文字部分的自定义View
- Dissecting the Camera Matrix
- 相机矩阵(Camera Matrix)
- linux下安装ssh
- Activiti 23张数据库表
- linux安装ssh
- 博为峰Java技术文章 ——JavaSE Swing JTabbedPane选项卡面板II
- VS2010下建立MFC程序
- 使用camera、matrix仿即刻APP换一换
- 假期训练—— Repeating Decimals UVA - 202 模拟
- sed 脚本分隔符引起的问题 的问题
- 1021. Deepest Root (25)
- Android源码之ArrayList
- XXX
- Python的charts和Jupyter的使用 使数据可视化 对58同城的爬取
- Bootstrap学习笔记(五)菜单、按钮及导航
- 关于Spring容器的理解