pragma mark -- 流星Animation
-
(void)staranimationWithImageView:(UIImageView *)imageView imagePoint:(CGPoint)point {
CAEmitterLayer *rainLayer = [CAEmitterLayer layer];
[rainLayer setEmitterPosition:point];
[rainLayer setEmitterSize:CGSizeMake(VKLCLength(400), VKLCLength(200))];
// 发射模式
[rainLayer setEmitterMode:kCAEmitterLayerLine];
[rainLayer setEmitterShape:kCAEmitterLayerLine];
[rainLayer setRenderMode:kCAEmitterLayerAdditive];CAEmitterCell *rainCell = [CAEmitterCell emitterCell];
[rainCell setBirthRate:1];
[rainCell setVelocity:100];
[rainCell setXAcceleration:-200];
[rainCell setYAcceleration:85];
[rainCell setScale:0.1];
[rainCell setScaleSpeed:0.2];
[rainCell setLifetime:1.8];
[rainCell setEmissionLongitude: 55 * (180.0 / M_PI)];
[rainCell setContents:(id)[[VKLCImageUtil getImageWithName:@"vklc_starRain"] CGImage]];
[rainCell setColor:[[UIColor colorWithRed:1 green:1 blue:1 alpha:0.6] CGColor]];[rainLayer setEmitterDepth:10];
rainLayer.emitterCells = [NSArray arrayWithObject:rainCell];
[imageView.layer addSublayer:rainLayer];
}
网友评论