Skip to content

Commit

Permalink
Update TRANSITIONTYPE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
danlozano authored Mar 24, 2017
1 parent 6dec970 commit 5b35649
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions TRANSITIONTYPE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Creating a custom TransitionType

To create a custom TransitionType you have to modify an existing **PresentrAnimation** or create your own. Then use the .custom **TransitionType** with your custom animation.
To create a custom TransitionType you have to modify an existing **PresentrAnimation** or create your own. Then initialize a **.custom** TransitionType with your animation.

### Modify an existing one

Expand All @@ -11,7 +11,9 @@ let animation = CoverVerticalAnimation(options: .spring(duration: 2.0,
delay: 0,
damping: 0.5,
velocity: 0))

let coverVerticalWithSpring = TransitionType.custom(animation)

presenter.transitionType = coverVerticalWithSpring
presenter.dismissTransitionType = coverVerticalWithSpring
```
Expand Down Expand Up @@ -62,7 +64,7 @@ Then, either:
- Override the **transform** method. It receives the Container Frame and Final Frame of the presented view controller. You need to return the Initial frame you want for the view controller, that way you can create a simple movement animation.

```swift
class CustomAnimation: PresentrAnimation {
class ExpandFromCornerAnimation: PresentrAnimation {

override func transform(containerFrame: CGRect, finalFrame: CGRect) -> CGRect {
return CGRect(x: 0, y: 0, width: 10, height: 10)
Expand Down Expand Up @@ -124,5 +126,5 @@ public struct PresentrTransitionContext {
Finally, create a custom TransitionType with your custom animation.

```swift
presenter.transitionType = .custom(CustomAnimation())
presenter.transitionType = .custom(ExpandFromCornerAnimation())
```

0 comments on commit 5b35649

Please sign in to comment.