TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2017 |
Maintained by coderfish.
ZLYWaterWave是一个简单好用的iOS水波效果工具,可以让你的APP更加好看有趣
ZLYWaterWave的原理很简单,我们用 Example 里的工程做简介。(这里首先要感谢 @hy,我敬爱的前辈,最初是从他这里学习的水波效果原理)
CocoaPods
pod ‘ZLYWaterWave’
直接安装
直接拽入 ZLYWaterWave.h
和 ZLYWaterWave.m
文件
- (ZLYWaterWave *)waterWave {
if (_waterWave == nil) {
// 给定的frame和你的图片frame一致即可
_waterWave = [[ZLYWaterWave alloc] initWithFrame:self.pic_red.frame];
_waterWave.delegate = self;
}
return _waterWave;
}
- (void)waterWave:(ZLYWaterWave *)waterWave wavePath:(UIBezierPath *)path {
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.path = path.CGPath;
// 添加遮盖
self.pic_red.layer.mask = maskLayer;
}
/** 水深占比,0 to 1; */
@property(nonatomic, assign)CGFloat waterDepth;
/** 波浪速度,默认 0.05f */
@property (nonatomic, assign) CGFloat speed;
/** 波浪幅度 */
@property (nonatomic, assign) CGFloat amplitude;
/** 波浪紧凑程度(角速度),默认 1.0 */
@property (nonatomic, assign) CGFloat angularVelocity;
/**
开始波动
*/
- (void)startAnimation;
/**
停止波动
*/
- (void)stopAnimation;
如果有什么修改建议,可以发送邮件到[email protected],也欢迎到我的博客一起讨论学习哟~
2016年11月7日更新
由于 CF 前缀有 Core Foundation
歧义,更改为 ZLY。