首页 > 代码库 > 爆炸的效果(IOS)

爆炸的效果(IOS)

爆炸的效果(IOS)

by 伍雪颖

技术分享

    CAEmitterLayer *emitter = [CAEmitterLayerlayer];
    emitter.frame =self.view.bounds;
    [
self.view.layeraddSublayer:emitter];
   
    emitter.
renderMode =kCAEmitterLayerAdditive;
    emitter.
emitterPosition =CGPointMake(emitter.frame.size.width/2, emitter.frame.size.height/2);
   
   
CAEmitterCell *cell = [[CAEmitterCellalloc]init];
    cell.
contents = (__bridgeid)[UIImageimageNamed:@"yuandan1"].CGImage;
    cell.
birthRate =150;
    cell.
lifetime =5;
    cell.
alphaSpeed = -0.4;
    cell.
velocity =50;
    cell.
velocityRange =50;
    cell.
emissionRange =M_PI *2.0;
   
    emitter.emitterCells =@[cell];

爆炸的效果(IOS)