Yalantis/StarWars.iOS

StarWarsAnimator: try to make snapshot blurEffect and corner

csjlengxiang opened this issue · 0 comments

I try make the snapshots in dismiss animation have blurEffect and corner.
let snapshot = (fromViewSnapshot!.resizableSnapshotView(from: snapshotRegion, afterScreenUpdates: false, withCapInsets: UIEdgeInsets.zero))!

blurEffect: I just add UIVisualEffectView to fromView and then
let fromViewSnapshot = fromView?.snapshotView(afterScreenUpdates: true)
this work well. all snapshot blurEffect.

but make snapshot corner I fail.

first i just use this
snapshot.layer.cornerRadius = width / 2
snapshot.layer.masksToBounds = true
but this have performance problems.

I try to solve this by use UIGraphicsGetCurrentContext clip the snapshot. by use
first. clip snapshot to image like http://stackoverflow.com/questions/25444609/screenshot-in-swift-ios. then clip image. and add image to imageview. at last. add it to containerView
but it not work. I do not know where is wrong.

sorry about my poor English.