项目作者: shu223

项目描述 :
Pulse animation for iOS
高级语言: Swift
项目地址: git://github.com/shu223/Pulsator.git
创建时间: 2016-04-11T20:52:23Z
项目社区:https://github.com/shu223/Pulsator

开源协议:MIT License

下载


Pulsator

Badge w/ Version
Carthage compatible
License
Twitter

Pulse animation for iOS written with Swift.

Great For:

  • Pulses of Bluetooth, BLE, beacons (iBeacon), etc.
  • Map Annotations

Installation

CocoaPods

Add into your Podfile.

  1. pod "Pulsator"

Then $ pod install

Carthage

Add into your Cartfile.

  1. github "shu223/Pulsator"

Then $ carthage update

How to use

Just 3 lines!

Initiate and add to your view’s layer, then call start!

  1. let pulsator = Pulsator()
  2. view.layer.addSublayer(pulsator)
  3. pulsator.start()

Customizations

Number of Pulses

Use numPulse property.

  1. pulsator.numPulse = 3

Radius

Use radius property.

  1. pulsator.radius = 240.0

Color

Just set the backgroundColor property.

  1. pulsator.backgroundColor = UIColor(red: 1, green: 1, blue: 0, alpha: 1).cgColor

Animation Duration

Use following properties

  • animationDuration : duration for each pulse
  • pulseInterval : interval between pulses

Easing

You can set the timingFunction property.

Repeat

Use repeatCount property.

Demo

You can try to change the radius, backgroundColor or other properties with the demo app.

  • Example/PulsatorDemo.xcodeproj

macOS support

Add into your Podfile, then run pod install.

  1. platform :osx, '10.9'
  2. target 'Pulsator' do
  3. use_frameworks!
  4. pod "Pulsator"
  5. end

The usage is same as iOS.

  1. let pulsator = Pulsator()
  2. view.layer?.addSublayer(pulsator)
  3. pulsator.start()

Objective-C version

There is an ObjC version, but it’s not maintained now.

You can use Pulsator also with Objective-C.

  1. #import "Pulsator-Swift.h"

Author

Shuichi Tsutsumi

iOS freelancer in Japan. Welcome works from abroad!


Support via PayPal