120 likes | 393 Views
MIT App Inventor. Lesson 4 – Drawing on a Canvas. Agenda. Drawing on a Canvas Events Touched Dragged Algorithms Increment / decrement. Canvas. Grid for animation and graphics Uses (x,y) coordinates to locate objects. (0,0). (300,0). (0,400). (300,400). Canvas components.
E N D
MIT App Inventor Lesson 4 – Drawing on a Canvas
Agenda • Drawing on a Canvas • Events • Touched • Dragged • Algorithms • Increment / decrement
Canvas • Grid for animation and graphics • Uses (x,y) coordinates to locate objects (0,0) (300,0) (0,400) (300,400)
Canvas components • coordinates provided to event handler • In this case the action is to Draw a Circle on the same canvas • can have multiple canvas objects
Controlling Objects • A separate canvas and sprite can be used as a game controller. • The value of draggedSprite is True when the sprite is being dragged
Algorithms Patterns Increment • Increase the value stored in a variable Decrement • Decrease the value stored in a variable
Lab 5 – Paint the Puppy ObjectiveCreate an interactive drawing program. • Components • Canvas • Concepts • Responding to user input • Touched • Dragged • Algorithms • Increment / Decrement of variables