Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s2mr/Elephant
Elegant SVG animation kit for swift
https://github.com/s2mr/Elephant
animation ios svg swift
Last synced: about 1 month ago
JSON representation
Elegant SVG animation kit for swift
- Host: GitHub
- URL: https://github.com/s2mr/Elephant
- Owner: s2mr
- License: apache-2.0
- Created: 2019-05-20T03:52:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T16:33:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-28T13:34:26.834Z (about 2 months ago)
- Topics: animation, ios, svg, swift
- Language: Swift
- Homepage:
- Size: 1.16 MB
- Stars: 139
- Watchers: 6
- Forks: 27
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - Elephant - Elegant SVG animation kit. (Libs / Animation)
- awesome-swift - Elephant - Elegant SVG animation kit for iOS (Libs / Animation)
- awesome-cocoa - Elephant
- awesome-swift - Elephant - Elegant SVG animation kit for swift ` π 9 months ago ` (Animation [π](#readme))
- awesome-swift - Elephant - Elegant SVG animation kit. (Libs / Animation)
README
Elephant
This is SVG animation presentation kit for iOS.
## Example
You can run example app. Please open `Example-iOS/Elephant-iOS.xcworkspace`!## Usage
You can display the svg image with animation.**We are supportted two animation formatsπ**
The format is below.
- Animation in SVG
- Animation in CSSUsage is difference by the format.
### SVGView initialization
This is initialization SVGView for format 1 (Animation in SVG) usage.
```swift
SVGView(named: "svg-filename", animationOwner: .svg)
```This is initialization SVGView for format 2 (Animation in CSS) usage.
```swift
SVGView(named: "svg-filename", animationOwner: .css, style: .cssFile(name: "css-filename"))
```### Show in your ViewController
And, you initialized view, you have to do is only add view to parent view, and start animation like below.
```swift
class ViewController: UIViewController {
let svgView = SVGView(named: "image", animationOwner: .svg)override func viewDidLoad() {
super.viewDidLoad()view.addSubview(svgView)
svgView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
svgView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
svgView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
svgView.widthAnchor.constraint(equalToConstant: 400),
svgView.heightAnchor.constraint(equalToConstant: 400),
])svgView.startAnimation()
// svgView.stopAnimation() // Stop animation.
// svgView.isAnimate { [weak self] (value, error) in
// if let error = error {
// print(error)
// }
// guard let value = value else { return } // value means whether animation is moving.
// }
}
}```
## Requirements
- Xcode 10.2
- Swift 5.0## Installation
### [Swift package manager](https://github.com/apple/swift-package-manager)
Add the following to the dependencies of your Package.swift:
``` swift
dependencies: [
.package(url: "https://github.com/s2mr/Elephant.git", from: "Elephant version"),
]
```### [CocoaPods](https://cocoapods.org)
Add this to `Podfile````ruby
pod 'Elephant'
``````bash
$ pod install
```### [Carthage](https://github.com/Carthage/Carthage)
Add this to `Cartfile````
github "s2mr/Elephant"
``````bash
$ carthage update --platform ios
```## Author
[Kazumasa Shimomura](https://www.kazuringo.xyz)
## License
Elephant is available under the Apache v2. See the LICENSE file for more info.
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%s2mr%2FElephant.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fs2mr%2FElephant?ref=badge_large)