Lotus 0.2.0

Lotus 0.2.0

Vladislav Kondrashkov 维护。



Lotus 0.2.0

  • Vladislav Kondrashkov

Lotus

Language Build Status codecov Version License Platform

Lotus – 一个强大的纳米级框架,它帮助实现通过简单语法进行层动画。此 DSL 可以减轻您通过 CoreAnimation 制作动画的常规代码。

Lotus

for i in 0..<10 {
    let petalLayer = PetalLayer()
    petalLayer.position = CGPoint(x: view.frame.width / 2, y: view.frame.height / 2 + 60)

    let direction: CGFloat = i % 2 == 0 ? -1.0 : 1.0
    let initialRotationDegree = 3.0 * CGFloat(i / 2) * .pi / 180.0
    let rotateTransform = CGAffineTransform.identity.rotated(by: direction * initialRotationDegree)
    petalLayer.setAffineTransform(rotateTransform)
    view.layer.addSublayer(petalLayer)

    let rotationDegree = 12.0 * CGFloat(i / 2) * .pi / 180.0
    petalLayer.lotus.runAnimation { make in
        make.opacity.to(0.7).during(0.7).delay(1.0)
    }.then { make in
        make.rotation.to(direction * rotationDegree).during(0.6)
    }.then { make in
        make.scaling.to(1.2).delay(0.3).during(1.5).ease(.outElastic)
    }
}

内容

入门指南

以下说明将帮助您将 Lotus 集成到项目中。

要求

  • Xcode 10.2+

安装

CrystalPods

1. 在终端切换到包含项目的仓库
2. 在您的 Podfile 中指定 Lotus

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Lotus'
end

3. 运行 pod install 命令

使用方法

1. 将 Lotus 导入您的项目

import Lotus

2. 创建任何图层并将其添加到 view 的层级结构

let redSquareLayer = CALayer()
redSquareLayer.frame = CGRect(x: 50, y: 50, width: 100, height: 100)
view.layer.addSublayer(redSquareLayer)

3. 然后根据需要运行任何动画

redSquareLayer.lotus.runAnimation { make in
    make.scaling.to(2.0)
}

文档

文档 中查看所有可用的功能

贡献

如果您发现任何错误,有伟大的新功能或想要改进文档 - 欢迎您!请访问 问题页面,选择模板,写下详细信息,我们将尽快回复您。

作者

  • 弗拉基斯拉夫·康德拉什科夫 - 初始工作 - vkondrashkov
  • 帕维尔·康德拉什科夫 - 导师,想法贡献者 - pkondrashkov

另请参阅参与此项目的 贡献者 列表。

许可

本项目受 MIT 许可证的许可 - 详细信息请参阅 LICENSE.md 文件