커스텀 클래스인 Graphic입니다.
public Graphic(String name, int drawType)
{
camera = new Camera();
camera.translate(960, -520, 0);//device size is 1980 x 1040
}
private void getResource(String name)
{
int drawableResourceId = activity.getApplicationContext().getResources().getIdentifier(name, "drawable", activity.getApplicationContext().getPackageName());
bitmap = BitmapFactory.decodeResource(activity.getApplicationContext().getResources(), drawableResourceId);
camera = new Camera();
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
}
public void Draw(Canvas canvas)
{
camera.rotateX(1);
camera.getMatrix(matrix);
canvas.concat(matrix);
canvas.drawBitmap(bitmap, src, dst, paint);
}
public void setDestination(Rect dst)
{
this.dst = new Rect(-250, -250, 250, 250);
}
이미지를 디바이스 정중앙에 맞춰놓고 rotateX(1)해서 매 프레임마다 이미지를 회전시켰습니다.
https://www.facebook.com/groups/codingeverybody/permalink/1839476729426188/?notif_t=video_processed¬if_id=1506144756337864
동영상을 어떻게 올리는지 몰라서 링크를 올립니다.
링크에 들어가보시면 동영상이랑 이미지가 하나 있습니다. 제가 처음에 코드를 짰을 때는 이미지처럼 회전하는걸 예상했는데 막상 실제로 코드를 돌려보니 동영상에 나오는 것처럼 약간 좌측에서 틀어져서 보는 듯하게 회전이 되는거 같습니다. 그리고 실제 이미지가 X축으로 회전했을때보다 더 늘어지는것 같기도 합니다. 어떻게 방법이 없을까요??