UIKit Dynamics

Post on 15-Jan-2015

762 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

A basic overview of UIKit Dynamics. Demo here: https://github.com/rob-brown/Demos

Transcript

UIKit DynamicsRobert Brown Twitter: @robby_brown ADN: @robert_brown

What is UIKit Dynamics?

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

What is UIKit Dynamics?Based on real-world interactions

Gravity

Collisions

Attachments

Snap

Forces

Weight

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

UIGravityBehavior

Gravity is a simple vector

Default is (0, 1) meaning straight down

Default constant is 1000 px/sec2

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

UIAttachmentBehavior

Acts like a rope, string, or spring

Damping is customizable

Has a length and two anchor points

Attachments are invisible

UISnapBehavior

Locks position and angle

Can use damping

UIPushBehavior

Simple force vector

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

UIDynamicItemBehaviorfriction

resistance

angularResistance

elasticity

density

allowsRotation

Composing Behaviors

Effect Combination

Bounce Gravity + collision

Drag and snap Attachment then snap

Lock screen Gravity + Collision + Attachment + Push

Magnet Multiple push

Demo

Questions?

Want to Learn More?

WWDC 2013 Session 206

WWDC 2013 Session 221

UIKit Dynamics Catalog Sample

top related