iOS实现爆炸的效果

jopen的头像 jopen 1016 2015-06-28 18:25 2

 基本信息

× 1   

浏览数: 4256

分享时间: 3 年 前

1


    CAEmitterLayer *emitter = [CAEmitterLayer layer];
    emitter.frame = self.view.bounds;
    [self.view.layer addSublayer:emitter];
   
    emitter.renderMode = kCAEmitterLayerAdditive;
    emitter.emitterPosition = CGPointMake(emitter.frame.size.width/2, emitter.frame.size.height/2);
   
    CAEmitterCell *cell = [[CAEmitterCell alloc] init];
    cell.contents = (__bridge id)[UIImage imageNamed:@"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];

  • zona的头像 zona 2016-10-09 19:21 代码数:0

    yuandan1 图片是?

您的评论: