Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Physics Based UI for Fun and Profit

Physics Based UI for Fun and Profit

A discussion of using physics to drive user interfaces on Android presented at Droidcon Montreal 2015.

Avatar for Will Bailey

Will Bailey

April 10, 2015
Tweet

Other Decks in Technology

Transcript

  1. Overview ▪ Material Design guidelines around motion ▪ Predefined and

    Dynamic Animations ▪ How a physics system complements Material Design ▪ Brief detour into physics ▪ Rebound Library Walk thru ▪ Comparison of Rebound and Android SDK Animation Techniques ▪ Physics animation techniques
  2. A Physics system complements Material Design ▪ Authentic motion with

    a declarative programming model ▪ Consistent Choreography ▪ Delightful to the user
  3. A simple library that accurately models spring dynamics for the

    purpose of driving physical animations.
  4. Design Goals ▪ Not a replacement for a full physics

    engine ▪ Lightweight and cheap to integrate ▪ Not opinionated about rendering ▪ Low level building block to construct higher level components from
  5. More interesting as a pattern than as a framework *

    * but it’s a not a bad implementation of the pattern
  6. What can it help you build? ▪ delightful transitions ▪

    toggles ▪ pagers ▪ scrollers ▪ Anything that involves goal driven animation with inertia…
  7. SpringSystem ▪ maintains a set of springs ▪ provides hooks

    for acting before and after each integration ▪ Is driven by a looper until equilibrium is achieved on all the springs it maintains ▪ allows synchronous and time choreographed simulation
  8. Spring ▪ A model of the motion of a spring

    ▪ accepts listeners and notifies of lifecycle events ▪ accepts a configuration object for defining spring tension and friction ▪ accepts a velocity and/or end value
  9. SpringSystem Spring SpringSystemListener SpringListener creates/observes observes observes SpringLooper drives Concrete

    Classes SteppingLooper SynchronousLooper ChoreographerAndroidSpringLooper LegacyAndroidSpringLooper Methods onSpringActivate onSpringUpdate onSpringAtRest onSpringEndStateChange Methods onBeforeIntegrate onAfterIntegrate SpringConfig SpringConfigRegistry holds has Methods setCurrentValue setEndValue setVelocity
  10. Utilities ▪ SpringConfig provides tension and friction values to a

    spring ▪ SpringUtil provides helper functions for clamping and interpolating values in ranges ▪ ChoreographerCompat polyfills the Choreographer timing API on pre-JellyBean
  11. More Utilities ▪ SpringConfiguratorView provides an Android View for live

    tuning your SpringConfigs while the app is running ▪ AnimationQueue and SpringChain can help you create cascading effects
  12. Future Plans ▪ Release more components built on Rebound ▪

    Iterate and Improve integration with Origami ▪ Create more examples of Rebound physics complementing Material design patterns