Get ready to bring your apps to life! Today we'll discover how to:
Welcome to the magical world of Drawing and Animation! In MIT App Inventor, we have three super cool components that will help us create awesome visual effects:
:bulb: Did you know? :emoji: The first computer animation was created in 1960! Now you're going to create your own animations - how cool is that?
Let's see all the amazing things we can create:
Uses of Drawing and Animation
Think of Canvas as your magical drawing board! :art:
Definition: A canvas is a two-dimensional touch-sensitive rectangular panel on which drawing can be done and sprites can be moved
It's like having a piece of paper on your phone screen where you can:
You can customize your Canvas to make it look exactly how you want! Here's what you can change:
:information_source: Remember! :bulb: Width and Height are measured in pixels (tiny dots on your screen). They must be positive numbers - you can't have a negative-sized canvas!
Here's something super cool - every spot on your Canvas has an address, just like houses on a street!
We use (X, Y) coordinates to find any location:
The upper left corner is always (0,0) - that's where we start counting!
Canvas Coordinate System Example
:bulb: Fun Fact! :dart: Game developers use coordinates just like this to know where everything is on the screen. Now you're thinking like a real game developer!
Now let's learn about the special events that make your Canvas come alive! These events tell us when someone touches or moves their finger on the screen.
When you drag your finger across the Canvas (like drawing a line):
Canvas Dragged Event Block
What happens:
This is when you make a quick swipe - like flicking something across the screen!
Canvas Flung Event Block
Cool things it tells you:
:bulb: Try This! :emoji: Imagine flinging a paper airplane - that's exactly what this event detects!
This happens when you first put your finger on the screen:
Canvas TouchDown Event Block
This happens when you lift your finger off the screen:
Canvas TouchUp Event Block
This is for quick taps - touch and immediately lift:
Canvas Touched Event Block
:information_source: Remember! :star2: These events are like your Canvas's superpowers - they let your app know exactly what the user is doing!
Get ready to meet your new digital friend - the ImageSprite!
Definition: A 'sprite' that can be placed on a Canvas.
Think of an ImageSprite as a picture that can come to life! It could be:
Your ImageSprite can do amazing things:
Want to make your sprite move on its own? Here's a fun example!
To make an ImageSprite move left across the screen:
:bulb: Direction Guide! :emoji:
- 0° = Right :emoji:️
- 90° = Up ⬆️
- 180° = Left ⬅️
- 270° = Down ⬇️
:information_source: Remember! :bulb: You can change any property at any time while your app is running. Want your butterfly to suddenly fly faster? Just change the Speed!
Your ImageSprite can detect special moments and react to them!
This is when your sprite bumps into another sprite - BOOM!
ImageSprite CollidedWith Event Block
What happens:
:bulb: Game Idea! :video_game: Use this to make a game where a butterfly collects flowers, or a spaceship avoids asteroids!
When someone flicks your sprite across the screen:
ImageSprite Flung Event Block
Super cool info you get:
This happens when two sprites were touching, but now they're not!
ImageSprite NoLongerCollidingWith Event Block
When to use this:
:information_source: Remember! :dart: These events help your sprites interact with each other - just like characters in your favorite video games!
Meet the Ball - the bouncy, colorful circle that loves to move around!
Definition: A round 'sprite' that can be placed on a Canvas.
Think of it as:
Your Ball can:
Let's make a ball bounce up like it's jumping!
Example: Ball moving upward:
:bulb: Did you know? :emoji: Real bouncing balls follow physics rules. In your app, you get to make your own rules - how cool is that?
Ball | ImageSprite |
---|---|
Always round ⭕ | Can be any shape! :emoji: |
Change color with PaintColor :art: | Use any image file :emoji:️ |
Change size with Radius :emoji: | Size depends on image :emoji: |
:information_source: Remember! :bulb: Ball is perfect when you need a simple circle that can change colors and sizes quickly!
Your Ball has special events that make it super fun to use in games!
When your ball hits another sprite - BONK!
Ball CollidedWith Event Block
Perfect for:
:bulb: Game Idea! :video_game: Create a game where the ball collects stars or avoids obstacles!
This is super special - it tells you when your ball hits the edge of the screen!
Ball EdgeReached Event Block
The edges have special numbers:
Edge Directions Diagram
Edge Direction Guide:
:information_source: Cool Tip! :bulb: Use the Bounce method after EdgeReached to make your ball bounce off walls - just like a real bouncing ball!
When someone flicks the ball across the screen:
Ball Flung Event Block
What you can do:
The event gives you:
:bulb: Try This! :dart: Make a mini golf game where you fling the ball into a hole!
Wow! You've learned all about Drawing and Animation in MIT App Inventor! Now you know how to:
:white_check_mark: Create and use a Canvas for drawing
:white_check_mark: Make ImageSprites move and interact
:white_check_mark: Design bouncing Balls for games
:white_check_mark: Use touch events to make your app interactive
:white_check_mark: Detect collisions between sprites
You're ready to create amazing animated apps and games! What will you build first? A drawing app? A bouncing ball game? The possibilities are endless! :rocket:
:information_source: Next Steps! :video_game: Try combining what you learned:
- Make a ball that changes color when it hits the edge
- Create a sprite that follows your finger
- Design a simple game with colliding objects
Keep experimenting and have fun creating! Remember, every great app developer started exactly where you are now. You're doing amazing! :emoji::sparkles: