Elephant

0.1.1

Elegant SVG animation kit for swift
s2mr/Elephant

What's New

0.1.1

2023-01-17T13:42:58Z

What's Changed

  • Add license scan report and status by @fossabot in #1
  • support SVGView and css file init from local file, made init methods more safety by @InnaLMC in #2
  • Applying transparency on webView callback by @yury-dymov in #5
  • Package.swift by @Maxvit5 in #6
  • Prevented flashing on load by @v-shemet in #7

New Contributors

Full Changelog: 0.1.0...0.1.1

Elephant

This is SVG animation presentation kit for iOS.

Swift5 Release CocoaPods Carthage
Platform Lincense

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 CSS

Usage is difference by the format.

SVGView initialization

This is initialization SVGView for format 1 (Animation in SVG) usage.

SVGView(named: "svg-filename", animationOwner: .svg)

This is initialization SVGView for format 2 (Animation in CSS) usage.

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.

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

CocoaPods

Add this to Podfile

pod 'Elephant'
$ pod install

Carthage

Carthage

Add this to Cartfile

github "kzumu/Elephant"
$ carthage update --platform ios

Author

Kazumasa Shimomura

License

Elephant is available under the Apache v2. See the LICENSE file for more info.

FOSSA Status

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed Jan 25 2023 09:53:20 GMT-0500 (GMT-05:00)