Giter VIP home page Giter VIP logo

comets's Introduction

Comets

☄️ Comets: Animating Particles in Swift

Swift Version License Platform Carthage compatible

comet.gif

animation made by kevin as part of Voicy design

implements Bennet van der Linden medium Comets: Animating Particles in Swift

Example

// Customize your comet
let width = view.bounds.width
let height = view.bounds.height
let comets = [Comet(startPoint: CGPoint(x: 100, y: 0),
                    endPoint: CGPoint(x: 0, y: 100),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: 0.4 * width, y: 0),
                    endPoint: CGPoint(x: width, y: 0.8 * width),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: 0.8 * width, y: 0),
                    endPoint: CGPoint(x: width, y: 0.2 * width),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: width, y: 0.2 * height),
                    endPoint: CGPoint(x: 0, y: 0.25 * height),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: 0, y: height - 0.8 * width),
                    endPoint: CGPoint(x: 0.6 * width, y: height),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: width - 100, y: height),
                    endPoint: CGPoint(x: width, y: height - 100),
                    lineColor: UIColor.white.withAlphaComponent(0.2)),
              Comet(startPoint: CGPoint(x: 0, y: 0.8 * height),
                    endPoint: CGPoint(x: width, y: 0.75 * height),
                    lineColor: UIColor.white.withAlphaComponent(0.2))]

// draw line track and animate
for comet in comets {
    view.layer.addSublayer(comet.drawLine())
    view.layer.addSublayer(comet.animate())
}

comet.gif

Requirements

Comets is written in Xcode 10, Swift 4.2, iOS 9.0 Required

📲 Installation

Comets is available through Cocoapods or Carthage.

Cocoapods

pod "Comets"

Carthage

github "cruisediary/Comets" ~> 0.2.1

❤️ Contribution

Pull requests are always welcomed 🏄🏼

👨‍💻 Author

cruz, [email protected]

🛡 License

Comets is available under the MIT license. See the LICENSE file for more info.

comets's People

Contributors

cruisediary avatar falsetru avatar

Watchers

James Cloos 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.