为开发人员提供具有简单动画效果的屏幕的库

动画背景

AnimationBackground是一个为开发人员提供具有简单动画效果的屏幕的库。您可以通过 Swift 包管理器将其包含在您的项目中。

安装

以下 URL 可包含在 Swift Package Manager 中。

https://github.com/January1st-98/AnimationBackground-Swift.git

用法

截至 2022 年 02 月 15 日,有两个功能可用。

  1. ABRainingView:显示用户注册的图像从视图顶部落到底部的屏幕,就像下雨一样。您可以注册多个映像。图像移动得越来越快。
  2. ABRisingView:此视图从下到上显示用户注册的图像。您可以注册多个映像。图像移动得越来越快。
ABRainingView ABRisingView
ABRainingView Example ABRisingView Exaple

ABRainingView, ABRisingView

The following steps are required to use and .ABRainingViewABRisingView

  1. Create class instance When you create an instance, you can adjust the opacity of the image by passing a data value of 0 to 1 to the opacity parameter.

    let rainingView = ABRainingView(opacity: 0.5)
    let risingView = ABRisingView(opacity: 1.0)
  2. Use the method to register the images to be used in the effect. configureImages(images:)

    rainView.configureImages(
            images: [
                UIImage(named: "swift-logo")!,
                UIImage(named: "python-logo")!,
                UIImage(named: "ruby-logo")!
            ]
        )
  3. Activate the animation through the method. It’s important to note that this needs to be done in viewDidLayoutSubviews because we need the size information of the views to run the animation and calculate the size of the image.activate

    override func viewDidLayoutSubviews() {
        rainView.activate()
    }

Author

License

AnimationBackground is available under the . See the LICENSE file for more info.MIT license

GitHub

点击跳转