This chapter is from the book
Here are final points to wrap up what you’ve read in this chapter:
- Dynamic animators and behaviors are like a UI building toy set. They are enormously fun to work with and produce a really great range of results. I best like interactions that direct the user to natural results like the snap zones shown in Listing 6-3 and ones that provide a user-based experience like the device gravity that coordinates with a motion manager in Listing 6-4.
- Although it’s easy to get super-flashy with all the built-in physics, some of the best effects are the subtlest. It’s the little flourishes—such as bounces when views enter and leave a screen, or collisions when collection items interact with each other—that produce the best results.
- Layering and coordinating behaviors can stylize and customize the otherwise default animations. The scaling, stacking, and rotation I added for Figure 6-2 help send the message that these items have been “put away.”
- Some things you might not initially think of as behaviors can turn out to be super-handy. You saw this with the “watcher” behavior in Listing 6-2. Although this custom behavior doesn’t introduce any view changes, it helps tune the dynamic system to produce greater responsiveness.
- Always consider behavior lifetimes. You should clean up after your behaviors if they’re short lived and retain them if they persist.
- Sometimes it’s simpler to create basic and keyframe animations like the ones you saw in Chapter 5, “Animation,” than to implement dynamic behaviors with the associated overhead.