Pulsator 0.6.0

Pulsator 0.6.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2019年6月
SPM支持SPM

shu223维护。




Pulsator 0.6.0

Pulsator

Badge w/ Version Carthage compatible License Twitter

使用Swift编写的iOS脉冲动画。

适合

  • 蓝牙,BTLE,信标(iBeacon)等的脉冲
  • 地图标注

安装

CocoaPods

将其添加到您的Podfile中。

pod "Pulsator"

然后运行 $ pod install

Carthage

将其添加到您的Cartfile中。

github "shu223/Pulsator"

然后运行 $ carthage update

如何使用

只需3行代码!

初始化并将其添加到视图的图层中,然后调用start

let pulsator = Pulsator()
view.layer.addSublayer(pulsator)
pulsator.start()

自定义

脉冲次数

使用 numPulse 属性。

pulsator.numPulse = 3

半径

使用 radius 属性。

pulsator.radius = 240.0

颜色

只需设置 backgroundColor 属性。

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

动画时长

使用以下属性

  • animationDuration : 每个脉冲的持续时间
  • pulseInterval : 脉冲之间的间隔

缓动

可以设置 timingFunction 属性。

重复

使用 repeatCount 属性。

示例

您可以通过示例应用程序尝试更改半径、背景颜色或其他属性。

  • 例如/PulsatorDemo.xcodeproj
<iframe src="https://appetize.io/embed/45kwjngp1xud45eeqhxqy8qqew?device=iphone6s&scale=75&autoplay=false&orientation=portrait&deviceColor=black" width="312px" height="653px" frameborder="0" scrolling="no"></iframe>

macOS支持

将其添加到Podfile中,然后运行pod install

platform :osx, '10.9'

target 'Pulsator' do
  use_frameworks!
  pod "Pulsator"
end

用法与iOS相同。

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

Objective-C版本

存在ObjC版本,但目前未维护。

您还可以使用Objective-C使用Pulsator。

#import "Pulsator-Swift.h"

作者

Shuichi Tsutsumi

日本iOS自由职业者。欢迎海外工作的委托!

Support via PayPal