fall 2007acs-1805 ron mcfadyen1 chapter 2 creating your first animation (an introduction to...
DESCRIPTION
Fall 2007ACS-1805 Ron McFadyen3 Creating an Animation Recommended approach Read the scenario, Design an animation using storyboards, Implement your design Test your design If the animation is not correct repeat this processTRANSCRIPT
![Page 1: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/1.jpg)
Fall 2007 ACS-1805 Ron McFadyen 1
Chapter 2
Creating Your First Animation
(An Introduction to Programming)
![Page 2: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/2.jpg)
Fall 2007 ACS-1805 Ron McFadyen 2
Creating an Animation
Given the description of a • story, • game, • simulation
create an Alice animation
![Page 3: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/3.jpg)
Fall 2007 ACS-1805 Ron McFadyen 3
Creating an Animation
• Recommended approach• Read the scenario, • Design an animation using storyboards, • Implement your design• Test your design• If the animation is not correct repeat this process
![Page 4: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/4.jpg)
Fall 2007 ACS-1805 Ron McFadyen 4
Example • Read the “First Encounter” scenario:
“After traveling through space, …• Design
• From the scenario, determine the problem to be solved: • What is the story to be told?• What objects are required?• What actions are needed?
• Use the storyboard technique to outline a solution• Implementation
• Create an initial scene• Translate the storyboard actions into code
• Test• Determine if the implementation meets the requirements of the
scenario
See pages 20+
![Page 5: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/5.jpg)
Fall 2007 ACS-1805 Ron McFadyen 5
Creating Your First Animation• First Encounter scenario:
After traveling through space, a robot-manned craft has just made a landing on a moon. The robot is on the moon and has set up a camera so earthbound scientists in Houston can view this historic event. The camera view shows the robot, the lunar Lander and some nearby rock formations. Suddenly an alien peeks out from behind a rock, surprising the robot. The robot looks around, spots the alien, and walks over to take a closer look. The alien is frightened and hides behind the rocks.
![Page 6: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/6.jpg)
Fall 2007 ACS-1805 Ron McFadyen 6
Storyboards
• Two forms you might use:• Visual
• hand-sketched • screen captures
• Textual • Algorithm• Pseudocode
![Page 7: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/7.jpg)
Fall 2007 ACS-1805 Ron McFadyen 7
Storyboards• The text’s textual storyboard
• The above outlines an algorithm – a set of instructions to follow to accomplish a task
• The above is also referred to as pseudocode – it is very close to the program code generated by Alice
Do the following steps in order alien moves up alien says "Slithy toves?" robot's head turns around robot turns to look at alien Do together robot moves toward the alien robot legs walk alien moves down
![Page 8: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/8.jpg)
Fall 2007 ACS-1805 Ron McFadyen 8
Your First Program• Implementing the design
• Select a world• Choose your objects• Create an initial scene• Edit World.my first method
• create instructions using objects, methods, …
See class demoNote how the animation
is developed piece by piece - incrementally
•Do in order•Do together•If/Else•Loop•While
•For all in order•For all together•Wait •Print •// comments
![Page 9: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/9.jpg)
Fall 2007 ACS-1805 Ron McFadyen 9
Your First ProgramTesting your implementation
• Play your world• Observe the behaviour• Is the behaviour what you expected?• If yes … then you are done• Otherwise … you have a bug and you need to
• Determine what needs to change• Is the scenario correct? • Is your design correct?• Is your code correct?
• Make the changes and repeat this whole process again
See class demo
![Page 10: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/10.jpg)
Fall 2007 ACS-1805 Ron McFadyen 10
Point of View• An object’s Point of View comprises its position and
orientation. • Position tells us where the object is in the world. • Orientation tells us the direction an object is facing.
• An object’s position is given by 3 values: location in the world’s LR axis, location in the world’s FB axis, location in the world’s UD axis. See the pointOfView.position property values.
• An object’s orientation is given by 3 values: yaw, pitch, roll. Yaw is the objects rotation about the UD axis. Pitch is the object’s rotation about the LR axis. Roll is the object’s rotation about the FB axis.
• See The PointOfView property for objects
![Page 11: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/11.jpg)
Fall 2007 ACS-1805 Ron McFadyen 11
Orientation of objects
• Each object has its own coordinate system that provides its own sense of direction
• If Bob is asked to turn left ¼ revolution, Bob’s sense of direction turns with him
forward
forward
Bob
Note here that Bob rotated on his up-down axis. An object’s yaw is how much the object is rotated along this up-down axis since its original position.
![Page 12: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/12.jpg)
Fall 2007 ACS-1805 Ron McFadyen 12
Orientation of objects
• Bob had just turned…
• Now if we ask Bob to move forward, Bob advances along the forward-backward axis
forward
forward
![Page 13: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/13.jpg)
Fall 2007 ACS-1805 Ron McFadyen 13
Orientation of objects
• Bob had moved forward…
• Now if we ask Bob to turn forward, Bob rotates on the left-right axis
forward
forward
right
Note here that Bob rotated on his left-right axis. An object’s pitch is how much the object is rotated along this left-right axis since its original position.
![Page 14: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/14.jpg)
Fall 2007 ACS-1805 Ron McFadyen 14
Orientation of objects
• Consider Bob back at …
• Now if we ask Bob to roll left, Bob rotates on the forward-backward axis
Note here that Bob rotated on his forward-backward axis. An object’s roll is how much the object is rotated along this forward-backward axis since its original position.
forward
forward
![Page 15: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/15.jpg)
Fall 2007 ACS-1805 Ron McFadyen 15
Orientation of objects
• Each object has its own coordinate system that provides its own sense of direction
• If Dave and Peter are asked to move forward, they go in opposite directions
• You reset an object’s coordinate system by using orient to to give both the same sense of direction
• Dave orient to Peter
forwardforward
forwardforward
Dave Peter
![Page 16: Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)](https://reader036.vdocuments.mx/reader036/viewer/2022082723/5a4d1ad27f8b9ab059971cc6/html5/thumbnails/16.jpg)
Fall 2007 ACS-1805 Ron McFadyen 16
Arguments
• Duration: the default length of time for an action is one second – this can be modified
• Style: the smoothness of an action is controlled using one of the values begin gently, begin abruptly, end gently, end abruptly
• As seen by: the sense of direction (orientation) for an action is by default determined by the object that is acting, but this can be changed by specifying a different object to use for direction