Awesome Open Source
Awesome Open Source

Material Motion

Reactive motion driven by Core Animation.

Swift 3.1.x iOS 9.0+ Build Status codecov CocoaPods Compatible Platform Docs Chat

This library includes a variety of ready-to-use interactions. Interactions are registered to an instance of MotionRuntime:

// Store me for as long as the interactions should take effect.
let runtime = MotionRuntime(containerView: <#view#>)
Interaction Snippet
let arcMove = ArcMove()
arcMove.from.value = = 
runtime.add(arcMove, to: )
runtime.add(ChangeDirection(withVelocityOf: gesture),
            to: )
runtime.add(DirectlyManipulable(), to: )
runtime.add(Draggable(), to: )
runtime.add(Rotatable(), to: )
runtime.add(Scalable(), to: )
            to: runtime.get(.layer).position)
let spring = Spring()
spring.destination.value = 
runtime.add(spring, to: )
let tossable = Tossable()
tossable.spring.destination.value = 
runtime.add(tossable, to: )
runtime.add(Tween(duration: 0.5, values: [1, 0]),
            to: runtime.get(.layer).opacity)


Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift libraries. CocoaPods automates the process of using third-party libraries in your projects. See the Getting Started guide for more information. You can install it with the following command:

gem install cocoapods

Add MaterialMotion to your Podfile:

pod 'MaterialMotion'

You will need to add use_frameworks! to your Podfile in order use Material Motion in your swift app.

A simple Podfile might look like so:

project 'MyApp/MyApp.xcodeproj'


target 'MyApp' do
  pod 'MaterialMotion'

Then run the following command:

pod install


Import the framework:

import MaterialMotion

You will now have access to all of the APIs.

Example apps/unit tests

Check out a local copy of the repo to accessthe Catalog application by running the following commands:

git clone
cd material-motion-swift
pod install
open MaterialMotion.xcworkspace

Case studies


A carousel with pages that scale in and fade out in reaction to their scroll position.

View the source.

Contextual transition

A contextual view can be used to create continuity during transitions between view controllers. In this case study the selected photo is the contextual view. It's possible to flick the view to dismiss it using the tossable interaction.

Makes use of: Draggable, Tossable, Transition, TransitionSpring, Tween.

View the source.

Floating action button transition

A floating action button transition is a type of contextual transition that animates a mask outward from a floating button.

Makes use of: Transition and Tween.

View the source.

Material expansion

A Material Design transition using asymetric transformations.

Makes use of: Tween.

View the source.

Modal dialog

A modal dialog that's presented over the existing context and is dismissable using gestures.

Makes use of: Tossable and TransitionSpring.

View the source.

Pull down to dismiss

A modal scroll view controller that can be dismissed with a drag gesture.

Makes use of: Tossable and TransitionSpring.

View the source.

Sticker picker

Each sticker is individually directly manipulable, meaning they can be dragged, rotated, and scaled using multitouch gestures.

Makes use of: DirectlyManipulable.

View the source.


We welcome contributions!

Check out our upcoming milestones.

Learn more about our team, our community, and our contributor essentials.


Licensed under the Apache 2.0 license. See LICENSE for details.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Swift (93,714
Ios (19,254
Animation (5,111
Reactive (1,306
Transition (568
Motion (314
Related Projects