国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 文登市| 曲松县| 顺义区| 福海县| 固原市| 宁南县| 南乐县| 荔波县| 香港| 余姚市| 庆安县| 德兴市| 庆元县| 固原市| 黎川县| 花莲市| 会东县| 尖扎县| 常山县| 舞钢市| 沐川县| 左云县| 韶关市| 双江| 夏邑县| 禹州市| 招远市| 玉山县| 辽中县| 西丰县| 金沙县| 凯里市| 射阳县| 高邑县| 清镇市| 万安县| 莱州市| 长治县| 锦屏县| 清镇市| 淄博市|