Git Product home page Git Product logo

pulsar's Introduction

jumbotron

Pulsar

Pulsar is a versatile solution for displaying pulse animations as known from Apple Maps.

Being implemented on CALayer, Pulsar is compatible with just about any UI control thinkable, given that every UIView is backed by a CALayer.

Preview

screencast

Features

Pulsar consists of a simple category on CALayer making use of the builder pattern for hassle-free customization:

  • Custom duration and repeat count.
  • Custom line width.
  • Custom background and/or border colors. (optional)
  • Custom path. (optional)
  • Start/stop blocks for attaching a callback. (optional)

While all these attributes can be set, none of them have to be set explicitly.

Pulsar will try to figure out the most likely default colors and paths on its own (inferred from the host layer's properties, such as its border color), unless one supplies it with custom properties via its builder.

For more info take a look at these methods:

    class func defaultBackgroundColorsForLayer(layer: CALayer) -> [CGColor]
    class func defaultBorderColorsForLayer(layer: CALayer) -> [CGColor]
    class func defaultPathForLayer(layer: CALayer) -> CGPathRef

Usage

To add a (one-time) pulse using smart default properties to a layer (e.g., the layer of a UIView) simply call addPulse() on it:

layer.addPulse()

Or if you want to set a custom appearance:

layer.addPulse { builder in
	builder.borderColors = [UIColor.redColor().CGColor]
	builder.backgroundColors = []
}

To have a pulse repeat a given number of times set a repeatCount on the builder:

builder.repeatCount = 42 // or Int.max for infinity

Installation

Just copy the files in "Pulsar/Classes/..." into your project.

Alternatively you can install Pulsar into your project with CocoaPods. Just add it to your Podfile: pod 'Pulsar'

Demos

Pulsar contains a demo app giving you a quick overview of some of the possible use cases.

Swift

Pulsar is implemented in Swift 3.

Dependencies

None.

Creator

Vincent Esche (@regexident)

License

Pulsar is available under a modified BSD-3 clause license with the additional requirement of attribution. See the LICENSE file for more info.

pulsar's People

Contributors

dlpigpen avatar regexident avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulsar's Issues

v2.0 is not public.

Using pod Pulsar still installing the 1.1.0 version, not the v2.0 (swift3).

Controlling pulse ripple distance

Hi, I appreciate you making this library, how can I control the distance of the pulse? I need the pulse ripples to not go so far off.

To clarify the circumference of the ripple expands too far outwards - I need it to expand a bit less before disappearing.

Thank you.

How to increase the pulse count?

Hi @regexident ,

Fist of all thank you for your awesome library for pulsar animation. But i am curious to know how to increase the ripple count, is there any property i need to access for increasing the ripple count.

Thanks & Cheers.
Pradeep Kumar

how do you stop the Pulsar? and 1 pulsar per?

if I initiate it how can I stop it?

also, when I call view.addPulsar is there a way if limit it to 1 addPulsar? when I run addPulsar multiple times on a view it adds multiple pulsars

Can I use it in Objective-C project?

Hi @regexident

How are you?
Thanks for your supporting great Pulsar.
By the way, I have an Objective-C project but I can't use Pod because there are some reasons.
Can I use it on Objective-C project by manual import?

Please let me know if possible.

Hope to hear from you soon.

Regards,
Billy

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.