Monday, November 3, 2014

Graphics and Animations



Go to Mind Mup: Graphics and Animations

Graphic and Animations

  • Animation
    • TransitionDrawable: Fade 1 drawable to another drawable
      • <transition> <item> </item> <item> </item> </transition>
    • AnimationDrawable: drawable slide show
      • <animation-list> <item> </item> .... .... </animation-list>
    • Animation: Animate the size, orientation, position of a view
      • <set> alpha: fade in/out rotate translate scale <set>
  • drawables
    • Shapes (xml)
    • Images (png)
  • Canvas
    • Generic View less frequent updates
    • SurfaceView More frequent updates
      • provide a secondary thread for drawing
        • 1- SETUP
          • Acquire the surface holder getHolder()
          • Register the surface view for call backs addCallBack() These callbacks are (called usually from main thread): surfaceCreated() surfaceChanged() surfaceDestroyed()
          • Create the secondary thread
        • 2- DRAW
          • Acquire lock on CANVAS: SurfaceHolder.lockCanvas()
          • Draw: Canvas.drawBitmap()
          • Unlock the canvas, allowing android to update and display: SurfaceHolder.unlockCanvasAndPost

No comments:

Post a Comment