Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

7. Motion > Translate, Rotate, Scale

Translate, Rotate, Scale

Changing the screen coordinates is an alternative technique to create motion. For instance, you can move a shape 50 pixels to the right, or you can move the location of coordinate (0,0) 50 pixels to the right—the visual result on screen is the same. By modifying the default coordinate system, we can create different transformations including translation, rotation, and scaling. Figure 7-3 demonstrates this graphically.

Translating, rotating, and scaling the coordinates.

Figure 7-3. Translating, rotating, and scaling the coordinates.

Working with transformations can be tricky, but the translate() function is the most straightforward, so we'll start with it. This function can shift the coordinate system left, right, up, and down with its two parameters.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial