Android: tween animation of a bitmap

前端 未结 4 618
醉话见心
醉话见心 2020-12-11 17:40

My app implements its own sprites by calling the following in my view\'s onDraw() method:

  canvas.drawBitmap(sprite.getBitmap(), sprite.getX(),         


        
4条回答
  •  暖寄归人
    2020-12-11 18:17

    If you are creating a game, you can use Vectors(Mathematical) to update the position of your images and then draw then with getX and getY. You should iterate and update this vector in some direction through some speed.

    Those Vectors are not native (Game APIs has).

    You need have a loop to iterate and update the position, then redraw.

    For games, it's not a good idea to have components such ImageViews to make animations. They need the system to calc all the layout again and again over time.

提交回复
热议问题