GlowingView 0.0.2

GlowingView 0.0.2

Cem Olcay 维护。



  • 作者:
  • cemolcay

GlowingView

一个基于CALayer阴影的自定义glow效果的UIView扩展。

演示

alt tag

试用

pod try GlowingView

要求

  • Xcode 8+
  • Swift 3+
  • iOS 10+

安装

use_frameworks!
pod 'GlowingView'

用法

使用可选参数调用 startGlowing 函数,以满足您的发光需求。
调用 stopGlowing 函数停止发光效果。

GlowingView 在目标视图上方添加一个私有的发光层,使用 CALayer 阴影和 CABasicAnimation 动画。

开始发光签名

  public func startGlowing(
    color: UIColor = .white,
    fromIntensity: CGFloat = 0,
    toIntensity: CGFloat = 1,
    fill: Bool = false,
    position: CGPoint? = nil,
    duration: TimeInterval = 1,
    repeat shouldRepeat: Bool = true)

演示使用

glowImageView?.startGlowing(
  color: .green,
  duration: 0.5)

fillGlowImageView?.startGlowing(
  color: .red,
  toIntensity: 0.4,
  fill: true,
  duration: 0.8)

鸣谢

代码大部分重构自 https://github.com/thesecretlab/UIView-Glow