17.9 ANIMATION
So far, we have seen objects being put on the screen. We are all familiar with the games. We say they contain animation. Animation is a technique of making objects appears to move on computer screen. How do we move objects?
First thing should be noted that there is some picture in background. The object(s) are in foreground. When object stands at any place, it hides details of the background. When an object leaves that place, those details are seen again!
Hence, simplest way to animate objects has to follow the following algorithm.
// Initialization Draw blank background. Draw the object. Capture the object in a variable. Draw normal (desired) background. Decide the place to keep the object at the start. Capture the image ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access