Introduction to Canvas Component

Canvas -- a sub-panel of the screen
  • App or user can draw in it
  • App can animate objects within it
Picture:





X,Y coordinate system

0-> width
0-> height

Canvas properties: Width, Height, BackgroundColor, PaintColor

Canvas functions: DrawCircle, DrawLine

Canvas events
    Touched(x,y) 

    Dragged(start,previous,current)

        note that dragged is triggered many times as user drags finger across the screen

Demo: Show x,y coordinates in a label when you touch canvas

    Set the width of the canvas to "Fill parent"
    note that event parameters are found in My Blocks (don't grab from event)
    How to draw a circle in middle of canvas?

http://www.youtube.com/watch?v=MrweyPm_6SY




Comments