MaterialMotionPopTransitions 1.0.0

MaterialMotionPopTransitions 1.0.0

TestsTested
LangLanguage SwiftSwift
License Apache 2
ReleasedLast Release Feb 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Jeff Verkoeyen.


Downloads

Total22
Week0
Month0

Installs

Apps1
Test Targets1
powered by Segment

GitHub

Stars1
Watchers6
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files2
LOCLines of Code 91


 
Depends on:
pop~> 1.0
MaterialMotionTransitions~> 1.0
MaterialMotionPop~> 2.0
 

  • By
  • The Material Motion Authors

POP Transitions for Material Motion (Swift)

Supported languages

  • Swift 3
  • Objective-C

Features

TransitionSpring makes it easy to describe bi-directional spring-based transitions.

Consider the following example of a simple “slide in” transition director:

class SlideInTransitionDirector: NSObject, TransitionDirector {
  let transition: Transition
  required init(transition: Transition) {
    self.transition = transition
  }

  func setUp() {
    let midY = Double(transition.foreViewController.view.layer.position.y)
    let height = Double(transition.foreViewController.view.bounds.height)
    let slide = TransitionSpring("position.y",
                                 transition: transition,
                                 back: NSNumber(value: midY + height),
                                 fore: NSNumber(value: midY))
    transition.runtime.addPlan(slide, to: transition.foreViewController.view.layer)
  }
}

In this director we’ve defined a single TransitionSpring that handles both the forward and backward transition. Going forward, a SpringTo with destination midY is emitted. Going backward, a SpringTo with destination midY + height is emitted.

Installation

Usage

Import the framework:

@import MaterialMotionPopTransitions;

You will now have access to all of the APIs.

Example apps/unit tests

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

git clone https://github.com/material-motion/pop-transitions-swift.git
cd pop-transitions-swift
pod install
open MaterialMotionPopTransitions.xcworkspace

Guides

  1. How to animate a CALayer property with a TransitionSpring plan

How to animate a CALayer property with a TransitionSpring plan

Code snippets:

In Objective-C:

MDMTransitionSpring *spring = [[MDMTransitionSpring alloc] initWithProperty:"<#key path#>"
                                                                 transition:transition
                                                                       back:<#back value#>
                                                                       fore:<#fore value#>];
[scheduler addPlan:spring to:<#Object#>];

In Swift:

let spring = TransitionSpring("<#key path#>",
                              transition: transition,
                              back: <#back value#>,
                              fore: <#fore value#>)
transition.scheduler.addPlan(spring, to: <#Layer#>)

Contributing

We welcome contributions!

Check out our upcoming milestones.

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

License

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