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
  • PrintPrint
Share this Page URL
Help

Chapter 7. Physics > 7.3. Time-Warp Functions

7.3. Time-Warp Functions

The AnimationTimer object listed in Example 7.6 also has some built-in time-warp functions, as shown in Example 7.7.

You can use the methods listed in Example 7.7 to implement a time-warp. For example, to implement the ease-in effect, you could do the following:

var ANIMATION_DURATION = 1000, // One second
    animation = new AnimationTimer(ANIMATION_DURATION,
                                   AnimationTimer.makeEaseIn(1));
    ...

The value that the preceding listing passes to AnimationTimer.makeEaseIn() controls the strength of the effect. In the next section, we show how that strength variable works, and we take a look at each of the effects implemented in Example 7.7.

Example 7.7. Time-warping functions


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

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

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint