ios中天女散花效果
来源:互联网 发布:环迅网络兼职是真的吗 编辑:程序博客网 时间:2024/05/16 00:57
添加<QuartzCore/QuartzCore.h>库,一张背景图和花瓣图
#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
@property (nonatomic,weak) IBOutletUIView *containerView;
@end
@implementation ViewController
- (void)viewDidLoad
{
[superviewDidLoad];
// cell.contents = (__bridge id)[UIImage imageNamed:@"47b5e3384e311b4f.jpg"].CGImage;
self.view.backgroundColor = [UIColorwhiteColor];
// =================== 背景图片 ===========================
UIImageView * backgroundView = [[UIImageViewalloc] initWithFrame:CGRectMake(0,0, self.view.bounds.size.width,self.view.bounds.size.height)];
backgroundView.image = [UIImageimageNamed:@"樱花树3iPhoneLandscapeiOS8_736x414pt@3x"];
backgroundView.contentMode =UIViewContentModeScaleAspectFill;
[self.viewaddSubview:backgroundView];
// =================== 樱花飘落 ====================
CAEmitterLayer * snowEmitterLayer = [CAEmitterLayerlayer];
snowEmitterLayer.emitterPosition =CGPointMake(100, -30);
snowEmitterLayer.emitterSize =CGSizeMake(self.view.bounds.size.width , 0);
snowEmitterLayer.emitterMode =kCAEmitterLayerOutline;
snowEmitterLayer.emitterShape =kCAEmitterLayerLine;
// snowEmitterLayer.renderMode = kCAEmitterLayerAdditive;
CAEmitterCell * snowCell = [CAEmitterCellemitterCell];
snowCell.contents = (__bridgeid)[UIImageimageNamed:@"樱花瓣2"].CGImage;
// 花瓣缩放比例
snowCell.scale =0.02;
snowCell.scaleRange =0.5;
// 每秒产生的花瓣数量
snowCell.birthRate =7;
snowCell.lifetime =80;
// 每秒花瓣变透明的速度
snowCell.alphaSpeed = -0.01;
// 秒速“五”厘米~~
snowCell.velocity =40;
snowCell.velocityRange =60;
// 花瓣掉落的角度范围
snowCell.emissionRange =M_PI;
// 花瓣旋转的速度
snowCell.spin =M_PI_4;
// 每个cell的颜色
// snowCell.color = [[UIColor redColor] CGColor];
// 阴影的不透明度
snowEmitterLayer.shadowOpacity =1;
// 阴影化开的程度(就像墨水滴在宣纸上化开那样)
snowEmitterLayer.shadowRadius =8;
// 阴影的偏移量
snowEmitterLayer.shadowOffset =CGSizeMake(3,3);
// 阴影的颜色
snowEmitterLayer.shadowColor = [[UIColorwhiteColor] CGColor];
snowEmitterLayer.emitterCells = [NSArrayarrayWithObject:snowCell];
[backgroundView.layeraddSublayer:snowEmitterLayer];
}
- ios中天女散花效果
- IOS中动画效果
- 【Android开源项目解析】仿支付宝付款成功及"天女散花"效果实现——看PathMeasure大展身手
- 软件需求与天女散花
- ios 中各种动画效果
- 仿ios中button效果
- iOS 中 视图模糊效果
- iOS中倒计时实现效果
- iOS中字迹动画效果
- iOS-直播中粒子效果
- iOS开发中毛玻璃效果
- iOS中实现模糊效果
- ios中实现3D效果--雪花飘的效果
- ios中view的动画效果
- ios中view的动画效果
- ios中达到Android中九妹图的效果
- iOS 7中实现模糊效果
- iOS 7中实现模糊效果
- Leetcode no. 40
- MongoDB菜鸟教程
- Case Study:SkyForm CMP助力业务应用实现自动伸缩
- eclipse运行mapreduce 提示:Caused by: java.lang.ArrayIndexOutOfBoundsException
- Spark应用远程调试
- ios中天女散花效果
- 78.iOS最全学习资源汇总
- 10个随机整数和 方法2
- 将matlab的数据保存xml 在c++下通过opencv读取;
- swift常用宏/获取设备信息
- 应聘中常用的SQL语句(数据库知识必杀)一共50个
- 《函数式编程思维》的图表注记
- VB第二次作业
- (4)