# ShapeAnimation-Swift
Vector animation framework in Swift based on [SwiftGraphics](https://github.com/schwa/SwiftGraphics) for iOS 8.
With ShapeAnimation you can easily create various animations with a nice Swift based syntax.
[![Travis][travis_img]][travis]
[travis]: https://travis-ci.org/rhcad/ShapeAnimation-Swift
[travis_img]: https://travis-ci.org/rhcad/ShapeAnimation-Swift.svg?branch=master
The current development happens on the [develop][develop] branch. Code is merged back on master branch infrequently.
SVG animation development with [SVGKit](https://github.com/SVGKit/SVGKit) happens on the [SVG][svg_branch] branch.
[develop]: https://github.com/rhcad/ShapeAnimation-Swift/tree/develop
[svg_branch]: https://github.com/rhcad/ShapeAnimation-Swift/tree/SVG
## What's included
* ShapeView class which contains vector shape layers.
* Helper functions to add image, text, circle, regular polygon, lines and other shapes.
* Support gradient fill with animation.
* Enumerate, hit-test or find layers.
* Animation extension functions of CALayer.
* opacityAnimation, flashAnimation, backColorAnimation
* scaleAnimation, tapAnimation, transformAnimation
* rotate360Degrees, rotationAnimation
* shakeAnimation, moveAnimation, moveOnPathAnimation
* slideToRight, slideAnimation, flipHorizontally, flipVertically
* Layer dragging: constrainCenterToSuperview, bringOnScreen
* Animation extension functions of CAShapeLayer.
* strokeStartAnimation, strokeEndAnimation, lineWidthAnimation
* strokeColorAnimation, fillColorAnimation, dashPhaseAnimation
* switchPathAnimation
* Group animation and cascaded animation.
* animationGroup for the same layer
* applyAnimations for multiple layers
* Use the block-based function in apply() to play cascaded animations.
* Pause, resume or stop animations.
* Animations with customized properties
* Use AnimationLayer class to draw customized animations.
* Animation with sliders example: [EllipseViewController.swift](ShapeAnimation_UITest/EllipseViewController.swift)
![Stroke Lines](Documentation/strokelines.gif)
![Move on Path](Documentation/moveonpath.gif)
![Radar Circles](Documentation/radar.gif)
![Rotate Polygons](Documentation/rotate_polygons.gif)
![Jumping Ball](Documentation/jumpball.gif)
![Animation with Sliders](Documentation/ellipse_slider.gif)
![Drag Layers](Documentation/drag.gif)
## Usage
Please see the examples in [MasterViewController.swift](ShapeAnimation_UITest/MasterViewController.swift).
``` Swift
let layer1 = self.addLinesLayer(view, points:[(10.0,20.0),(150.0,40.0),(120.0,320.0)])
layer1.strokeEndAnimation().apply() {
layer1.shakeAnimation().apply()
}
let la2 = self.addLinesLayer(view, points:points2, color: UIColor.blueColor())
lla2.scaleAnimation(from:1, to:1.1, repeatCount:3).apply(duration:0.3)
let la3 = self.addLinesLayer(view, points:points3, color: UIColor.greenColor())
la3.flashAnimation(repeatCount:6).apply()
let la4 = self.addLinesLayer(view, points:[(10.0,20.0), (150.0,40.0), (120.0,120.0)])
let a1 = la4.moveOnPathAnimation(path).setDuration(1.6)
let a2 = la4.rotate360Degrees().setRepeatCount(2)
animationGroup([a1, a2]).autoreverses().apply()
```
## Help Wanted
All of this code is very much a _*work in progress*_. I'm adding and changing functionality as needed.
Your help wanted. Please fork this project and submit pull requests or [issues][issues].
[issues]: https://github.com/rhcad/ShapeAnimation-Swift/issues
Contributions are always welcome in the following areas:
* Header doc comments explaining what the functions do
* Useful animation template or application examples
* Fix issues about animation, Swift usage rules or translations
## License
ShapeAnimation-Swift is released under a BSD License. See LICENSE file for details.
## FAQ
* Could not build Objective-C module 'ShapeAnimation':
- Quit Xcode and delete the sub folders in ~/Library/Developer/Xcode/DerivedData/.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
动画-Swift Swift 中的矢量动画框架,基于iOS 8 的SwiftGraphics 。 使用 ShapeAnimation,您可以使用基于 Swift 的良好语法轻松创建各种动画。 当前的开发发生在开发分支上。代码很少合并回主分支。 使用SVGKit进行 SVG 动画开发发生在SVG分支上。 包含什么 ShapeView 类包含矢量形状图层。 添加图像、文本、圆形、正多边形、直线和其他形状的辅助功能。 支持动画渐变填充。 枚举、命中测试或查找图层。 CALayer的动画扩展功能。 opacityAnimation、flashAnimation、backColorAnimation 缩放动画、点击动画、变换动画 旋转360度,旋转动画 shakeAnimation、moveAnimation、moveOnPathAnimation SlideToRight、slideAnimation、水平翻转、垂直翻转 图层拖动:constrainCenterToSuperview、bringOnScreen
资源推荐
资源详情
资源评论
收起资源包目录
ShapeAnimation-Swift-master.zip (48个子文件)
ShapeAnimation-Swift-master
Documentation
strokelines.gif 323KB
ellipse_slider.gif 385KB
rotate_polygons.gif 187KB
jumpball.gif 37KB
moveonpath.gif 649KB
drag.gif 1.11MB
radar.gif 113KB
.travis.yml 249B
LICENSE 1KB
ShapeAnimation
Animation
CALayer+Animation.swift 7KB
AnimationLayer.swift 4KB
CAShapeLayer+Animation.swift 5KB
CALayer+Drag.swift 1KB
AnimationPair.swift 6KB
CALayer+Pause.swift 1KB
CALayer+Slide.swift 3KB
AnimationPrivate.swift 4KB
ShapeAnimation.h 507B
View
CAShapeLayer+Path.swift 956B
ShapeView.swift 3KB
ShapeView+HitTest.swift 3KB
CAShapeLayer+Style.swift 3KB
CALayer+ID.swift 1KB
ShapeView+Image.swift 3KB
CAShapeLayer+Gradient.swift 3KB
Info.plist 824B
ShapeAnimation.xcodeproj
xcshareddata
xcschemes
ShapeAnimation_UITest.xcscheme 4KB
ShapeAnimation.xcscheme 4KB
project.pbxproj 37KB
project.xcworkspace
contents.xcworkspacedata 159B
ShapeAnimation_UITest
MasterViewController.swift 8KB
EllipseViewController.swift 3KB
Images.xcassets
AppIcon.appiconset
Contents.json 1KB
Base.lproj
Main.storyboard 36KB
LaunchScreen.xib 4KB
MasterVC+Drag.swift 4KB
BallViewController.swift 546B
AppDelegate.swift 418B
Images
airship@2x.png 15KB
MasterVC+Hamburger.swift 4KB
Info.plist 2KB
DetailViewController.swift 910B
.gitmodules 114B
Vendor
SwiftGraphics
.gitignore 322B
ShapeAnimation_UnitTests
DummyTests.swift 379B
Info.plist 751B
SwiftUtilities_Tests.swift 3KB
README.md 4KB
共 48 条
- 1
资源评论
前网易架构师-高司机
- 粉丝: 8904
- 资源: 496
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- YOLOv8完整网络结构图详细visio
- LCD1602电子时钟程序
- 西北太平洋热带气旋【灾害风险统计】及【登陆我国次数评估】数据集-1980-2023
- 全球干旱数据集【自校准帕尔默干旱程度指数scPDSI】-190101-202312-0.5x0.5
- 基于Python实现的VAE(变分自编码器)训练算法源代码+使用说明
- 全球干旱数据集【标准化降水蒸发指数SPEI-12】-190101-202312-0.5x0.5
- C语言小游戏-五子棋-详细代码可运行
- 全球干旱数据集【标准化降水蒸发指数SPEI-03】-190101-202312-0.5x0.5
- spring boot aop记录修改前后的值demo
- 全球干旱数据集【标准化降水蒸发指数SPEI-01】-190101-202312-0.5x0.5
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功