项目介绍:
SwiflyOverlay
SwiflyOverlay是一个全屏菜单,通过点击按钮弹出一个全屏菜单,点击不同菜单项会跳转不同控制器。带动画效果。
展开菜单(menu)代码:
[Objective-C] 查看源文件 复制代码
overlay?.open()
取消(dismiss)代码:
[Objective-C] 查看源文件 复制代码
overlay?.dismissView()
动画效果代码:
[Objective-C] 查看源文件 复制代码
let fadeAnimation = CABasicAnimation(keyPath: "opacity") fadeAnimation.fromValue = 0.0 fadeAnimation.toValue = 1.0 fadeAnimation.duration = 0.3 fadeAnimation.fillMode = kCAFillModeForwards let scaleAnimation = CABasicAnimation(keyPath: "transform.scale") scaleAnimation.toValue = 1.0 scaleAnimation.fromValue = 0.8 scaleAnimation.duration = 0.3 scaleAnimation.fillMode = kCAFillModeForwards let groupAnimation = CAAnimationGroup() groupAnimation.duration = 0.3 groupAnimation.animations = [fadeAnimation, scaleAnimation] groupAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
DEMO 直接下载: