Top Banner
UIKit Dynamics Robert Brown Twitter: @robby_brown ADN: @robert_brown
14

UIKit Dynamics

Jan 15, 2015

Download

Technology

Robert Brown

A basic overview of UIKit Dynamics. Demo here: https://github.com/rob-brown/Demos
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: UIKit Dynamics

UIKit DynamicsRobert Brown Twitter: @robby_brown ADN: @robert_brown

Page 2: UIKit Dynamics

What is UIKit Dynamics?

A composable, reusable, declarative, real-world inspired animation and interaction system.

Page 3: UIKit Dynamics

What is UIKit Dynamics?Based on real-world interactions

Gravity

Collisions

Attachments

Snap

Forces

Weight

Page 4: UIKit Dynamics

Limitations

It is possible to create behaviors that can’t be satisfied

Not completely accurate physics

Does not replace Core Animation, UIView animations, or motion effects

Only supports 2D transforms

Page 5: UIKit Dynamics

UIGravityBehavior

Gravity is a simple vector

Default is (0, 1) meaning straight down

Default constant is 1000 px/sec2

Page 6: UIKit Dynamics

UICollisionBehavior

Views can collide with boundaries and other views

Views can collide conditionally with other views

Callbacks for when collisions begin and end (UICollisionBehaviorDelegate)

Collisions have a CPU cost

Page 7: UIKit Dynamics

UIAttachmentBehavior

Acts like a rope, string, or spring

Damping is customizable

Has a length and two anchor points

Attachments are invisible

Page 8: UIKit Dynamics

UISnapBehavior

Locks position and angle

Can use damping

Page 9: UIKit Dynamics

UIPushBehavior

Simple force vector

1 UIKit Newton accelerates a (100,100) view by 100 px/sec2

Page 10: UIKit Dynamics

UIDynamicItemBehaviorfriction

resistance

angularResistance

elasticity

density

allowsRotation

Page 11: UIKit Dynamics

Composing Behaviors

Effect Combination

Bounce Gravity + collision

Drag and snap Attachment then snap

Lock screen Gravity + Collision + Attachment + Push

Magnet Multiple push

Page 12: UIKit Dynamics

Demo

Page 13: UIKit Dynamics

Questions?

Page 14: UIKit Dynamics

Want to Learn More?

WWDC 2013 Session 206

WWDC 2013 Session 221

UIKit Dynamics Catalog Sample