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

首頁 > 學院 > 開發設計 > 正文

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

2019-11-09 18:31:50
字體:
來源:轉載
供稿:網友
@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(); }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 冷水江市| 宜宾市| 南召县| 丹凤县| 新津县| 阳山县| 阿合奇县| 密山市| 平江县| 云浮市| 永福县| 定陶县| 大厂| 巴彦淖尔市| 肥城市| 山西省| 太仆寺旗| 改则县| 焉耆| 贵州省| 贺州市| 贵溪市| 合作市| 应城市| 高雄市| 宣汉县| 锡林郭勒盟| 达孜县| 凉山| 房产| 温泉县| 西乌| 防城港市| 怀柔区| 静宁县| 都江堰市| 靖宇县| 鹤山市| 宁强县| 平遥县| 泰安市|