Skip to content

Commit

Permalink
mask child
Browse files Browse the repository at this point in the history
  • Loading branch information
Satoshi Nakajima committed Nov 23, 2016
1 parent 11b9177 commit 42fea89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sample/sample/SwipeVideoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SwipeVideoController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
videoLayer = AVPlayerLayer(player: self.videoPlayer)
overlayLayer.masksToBounds = true
view.layer.addSublayer(self.videoLayer)
view.layer.addSublayer(self.overlayLayer)
}
Expand All @@ -44,8 +45,8 @@ class SwipeVideoController: UIViewController {
viewSize.height / dimension.height)
var xf = CATransform3DMakeScale(scale, scale, 0)
xf = CATransform3DTranslate(xf,
(scale - 1.0) * dimension.width / 2.0 / scale + (viewSize.width - dimension.width * scale) / 2.0 / scale,
(scale - 1.0) * dimension.height / 2.0 / scale + (viewSize.height - dimension.height * scale) / 2.0 / scale, 0.0)
(viewSize.width - dimension.width) / 2.0 / scale,
(viewSize.height - dimension.height) / 2.0 / scale, 0.0)
self.videoLayer.transform = xf
self.overlayLayer.transform = xf
}
Expand Down

0 comments on commit 42fea89

Please sign in to comment.