Giter Site home page Giter Site logo

elephant's Introduction

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

Add this to Podfile

pod 'Elephant'
$ pod install

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.

elephant's People

Contributors

s2mr avatar

Stargazers

Husnain Ali avatar MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.