0

Im working on a spritekit game where id like to do this "whirlpool" effect of my srite.

The image i added to a small extent hints at what i would like to accomplish.

For example, if i had clicked on the space ship (in the imagE) I would like to use this "spiral" effect on it (not exactly this effect but one that whirls & distorts my sknode . instead of on the entire scene. I was thinking to use CIFilers on my sprite but i read thoose are only for images.

Any hints on going about this would be appreciated.

I have this code to rotate an zoom out the player, just cant figure out how to do the whirlpool blur

 [_player runAction:
   [SKAction sequence:@[
                        [SKAction group:@[
                           [SKAction rotateByAngle:M_PI * 4 duration:1.0],
                   [SKAction scaleTo:0 duration:1.0]
                                          ]],
                        ]]];
}

enter image description here

Larme
  • 24,190
  • 6
  • 51
  • 81
Sleep Paralysis
  • 449
  • 7
  • 22

1 Answers1

1

Matt answered a similar question with this code:

UIImage *ship = [UIImage imageNamed:@"Spaceship.png"];
CIImage *shipImage = [[CIImage alloc] initWithImage:ship];
CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues:kCIInputImageKey, shipImage, @"inputIntensity", [NSNumber numberWithFloat:0.6], nil];
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *out = [filter outputImage];
CGImageRef cg = [context createCGImage:out fromRect:[out extent]];
SKTexture *texDone = [SKTexture textureWithCGImage:cg];

You can find his original answer here: SpriteKit SKTexture Crash

Community
  • 1
  • 1
sangony
  • 11,636
  • 4
  • 39
  • 55