This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-candidate' into stable
- Loading branch information
Showing
30 changed files
with
623 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module: MaterialMotion | ||
module_version: 1.0.0 | ||
module_version: 1.1.0 | ||
sdk: iphonesimulator | ||
xcodebuild_arguments: | ||
- -workspace | ||
- MaterialMotion.xcworkspace | ||
- -scheme | ||
- MaterialMotion | ||
github_url: https://github.com/material-motion/material-motion-swift | ||
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.0.0 | ||
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2016-present The Material Motion Authors. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import UIKit | ||
import MaterialMotion | ||
|
||
class ChangeDirectionOnReleaseExampleViewController: ExampleViewController { | ||
|
||
var runtime: MotionRuntime! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
let targetView = center(createExampleSquareView(), within: view) | ||
targetView.layer.borderColor = targetView.backgroundColor?.cgColor | ||
targetView.layer.borderWidth = 1 | ||
targetView.backgroundColor = nil | ||
view.addSubview(targetView) | ||
|
||
let exampleView = center(createExampleView(), within: view) | ||
view.addSubview(exampleView) | ||
|
||
runtime = MotionRuntime(containerView: view) | ||
|
||
let direction = createProperty(withInitialValue: TransitionDirection.backward) | ||
|
||
let positionSpring = TransitionSpring(back: CGPoint(x: view.bounds.midX, y: view.bounds.height * 4 / 10), | ||
fore: CGPoint(x: view.bounds.midX, y: view.bounds.height * 6 / 10), | ||
direction: direction) | ||
let tossable = Tossable(spring: positionSpring) | ||
runtime.add(ChangeDirection(withVelocityOf: tossable.draggable.nextGestureRecognizer, | ||
whenNegative: .backward, | ||
whenPositive: .forward), | ||
to: direction) | ||
runtime.add(tossable, to: exampleView) | ||
runtime.add(positionSpring, to: runtime.get(targetView.layer).position) | ||
} | ||
|
||
override func exampleInformation() -> ExampleInfo { | ||
return .init(title: type(of: self).catalogBreadcrumbs().last!, | ||
instructions: "Toss the view to change its position.") | ||
} | ||
} |
Oops, something went wrong.