FlyingViewsAnimation 是一个可自定义的视图,可以让您通过在整个背景中随机分布的连续飞行视图流来装饰您的 iOS 应用程序。
RPReplay_Final1711058987.mov
以下是 FlyingViewsAnimation 视图最基本的使用和定制的示例。
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let animatedView = AnimatedView()
animatedView.set(item: { UIImageView(image: UIImage(systemName: "sparkle")) })
animatedView.set(colors: [.cyan,.blue,.gray])
animatedView.set(angle: 60)
animatedView.setItem(size: 30)
animatedView.frame = self.view.bounds
self.view.addSubview(animatedView)
animatedView.start()
}
}
要停止动画并消失所有移动的视图,请调用
animatedView.stop()
iOS 15+,Swift 5.5
FlyingViewsAnimation 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod "FlyingViewsAnimation"
FlyingViewsAnimation 在 BSD-3 许可证下提供。有关详细信息,请参阅 LICENSE 文件。