Skip to content
项目

关于

Pulsing animation for Swift

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

SwiftPulse

This is an iOS component for creating a single pulsing animation. It's a clone from PulsingHalo - so basically all the credits go to @shu223.

I just needed the single pulse animation (left one of the image) and decided to port it to Swift with some minor changes of the interfaces.

PulsingHalo

How to use

  1. Add LFTPulseAnimation to your project.
  2. Init LFTPulseAnimation (e.g. with its custom constructor) and add it to the view
pulseEffect = LFTPulseAnimation(repeatCount: Float.infinity, radius:20, position:imageView.center)
view.layer.insertSublayer(self.pulseEffect, below: imageView.layer)

Customization

radius

Use the radius property to set the max size of the pulse effect.

pulseEffect.radius = 60

color

This is is basically a subclass of CALayer so you can access the backgroundColor attribute of CALayer and set it like you are used to it.

animation duration

Use self.animationDuration to set the duration of one animation cycle. Use the self.pulseInterval property to add an interval to the duration.

animation repeat count

Initialize using LFTPulseAnimation(repeatCount: Float.infinity, radius:20, position:iv.center) to set the repeat count or use the repeatCount property

more properties

For more adjustment just look in the code, it's very easy to understand and should be seld documenting.

Issues & PRs

If someone is interested in porting the multiple pulse effect before I will do it just let me know or do a Pull Request ;)

Special Thanks

Special thanks to @shu223 for PulsingHalo!

探索相关项目

加载中…