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
// From Paul's code | |
@IBOutlet weak var fancyButton: FancyButton! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let twitter = FancySubButton(image: UIImage.fancy_twitter()) { | |
// Do the sharing here | |
} |
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
// From Andrew's code | |
rippleAnimation.applyToView(bottomView, fromView: tappedView, duration: rippleAnimationDuration) |
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
// From Andrew's code | |
func applyToView(view: UIView, fromView: UIView, duration: NSTimeInterval) { | |
let rect = view.convertRect(fromView.bounds, fromCoordinateSpace: fromView) | |
applyToView(view, fromRect: rect, duration: duration) | |
} | |
func applyToView(view: UIView, fromRect: CGRect, duration: NSTimeInterval) { | |
view.addSubview(tintView) |
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
// From Andrew's code | |
override func viewDidLayoutSubviews() { | |
let halfHeight = CGRectGetHeight(shareContainerView.bounds) / 2; | |
shareContainerView.layer.cornerRadius = halfHeight | |
topView.layer.cornerRadius = halfHeight | |
} |
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
// From Andrew’s code | |
private func open() { | |
// First shift the bottom view all the way to the right | |
bottomViewLeading.constant = CGRectGetWidth(shareContainerView.bounds) | |
view.layoutIfNeeded() | |
// Now animate the views into place | |
topViewLeading.constant = -CGRectGetWidth(shareContainerView.bounds) | |
bottomViewLeading.constant = 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
// Calculate whether we want to go clockwise or | |
// counter-clockwise to get to target vector, and what the | |
// desired torque value will be. | |
var target = ThrusterAIUtils.findTargetTorque( | |
currentAngularVelocity, | |
targetAngle, | |
physics.body.m_invI, | |
this.maxCCW, -this.maxCW | |
); |
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
target[0] = tgtF * weightF; | |
target[1] = tgtR * weightR; | |
target[2] = tgtT * weightT; | |
// ... | |
current[0] += thruster.localForce[0] * coeff * weightF; | |
current[1] += thruster.localForce[1] * coeff * weightR; | |
current[2] += thruster.torque * coeff * weightT; |
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
if ( closest !== Infinity ) { | |
// Found an adjustment that improves the results, so set the | |
// coefficient to its new value. | |
thrusters[ closestIdx ].coeff = closestCoeff; | |
return false; | |
} else { | |
// No adjustment was found, so we have converged. | |
return true; | |
} |
NewerOlder