国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

使用camera、matrix仿即刻APP換一換

2019-11-09 17:25:24
字體:
來源:轉載
供稿:網友
@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(); }
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 东港市| 抚宁县| 南澳县| 新龙县| 罗平县| 青铜峡市| 崇礼县| 宁化县| 泸定县| 自治县| 崇阳县| 兴仁县| 江山市| 龙川县| 龙门县| 塔河县| 天镇县| 恩平市| 双牌县| 自治县| 五大连池市| 南郑县| 玛沁县| 河北省| 泉州市| 玉环县| 高平市| 营山县| 玉树县| 武宣县| 绵竹市| 宜丰县| 呼和浩特市| 江陵县| 河源市| 新绛县| 瓦房店市| 喀什市| 思茅市| 三明市| 上饶市|