Skip to content

Instantly share code, notes, and snippets.

@lawreyios
Last active October 28, 2017 16:10
Show Gist options
  • Save lawreyios/c0e21371de2760f8bc71c1f3b8ae739e to your computer and use it in GitHub Desktop.
Save lawreyios/c0e21371de2760f8bc71c1f3b8ae739e to your computer and use it in GitHub Desktop.
class FMViewController: UIViewController {
@IBOutlet weak var qnImageView: UIImageView!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
fadeInQuestion1()
}
func addMaskView(startingPoint: StartingPoint, y: CGFloat, mask: Int) -> MaskView {
let mq = Mask(named: "mq\(mask)")
var maskView = MaskView(frame: CGRect.getMaskRectLeft(y: y))
if startingPoint == .Right { maskView = MaskView(frame: CGRect.getMaskRectRight(y: y)) }
maskView.image = mq
view.addSubview(maskView)
return maskView
}
func addTransformTo(mask: MaskView, startingPoint: StartingPoint, duration: Int, delay: Int) {
let translationX: CGFloat = startingPoint == .Left ? 1920 : -2250
let transform = CGAffineTransform(translationX: translationX, y: 0).rotated(by: CGFloat(Double.pi))
UIView.animate(withDuration: TimeInterval(duration), delay: TimeInterval(delay), options: .curveLinear, animations: {
mask.transform = transform
}, completion: nil)
}
override var prefersStatusBarHidden: Bool { return true }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment