“Masking” an animation? iPhone SDK?

I haven't tried this for performance, but you can use a Core Animation layer as a mask. You can define a path to use in a CAShapeLayer and fill the shape. Then specify the layer mask of your UIImageView's layer.

Something like.

I haven't tried this for performance, but you can use a Core Animation layer as a mask. You can define a path to use in a CAShapeLayer and fill the shape. Then specify the layer mask of your UIImageView's layer.

Something like: CGMutablePathRef path = CGPathCreateMutable(); // build the path by adding points // ... CAShapeLayer *shapeLayer = CAShapeLayer alloc init; shapeLayer setPath:path; shapeLayer setFillColor:UIColor blackColor CGColor; // Set shape layer bounds and position // ... // Set the mask for the image view's layer imageView layer setMask:shapeLayer; Keep in mind that this isn't actually creating a new image as the link you reference does. This just creates a mask for display over top of your image view--which may not be what you want.

Thanks matt, just what I was looking for, upped your answer as well. – John Ballinger Dec 3 '09 at 22:12.

I searched high and low and finally found a solution with practically no limitations at all. So, here you go: UIImageView *maskeeImage = UIImageView alloc initWithImage:UIImage imageNamed:@"MaskeeImage. Png"; maskeeImage setAnimationRepeatCount:-1; maskeeImage setAnimationImages:NSArray alloc initWithObjects:UIImage imageNamed:@"MaskeeImage1.

Png", UIImage imageNamed:@"MaskeeImage2. Png", UIImage imageNamed:@"MaskeeImage3. Png", nil; maskeeImage startAnimating; CALayer *maskeeLayer = maskeeImage layer; maskeeLayer = CGRectMake(0, 0, 768, 1004); self view layer addSublayer:maskeeLayer; UIImage *maskImage = UIImage imageNamed:@"ImageMask.

Png"; CALayer *maskLayer = CALayer layer; maskLayer. Contents = (id) myImageMask. CGImage; maskLayer.

Frame = CGRectMake(0, 0, 768, 1004); maskeeLayer setMask:maskLayer; There you go! It's actually really easy, once you know how. I tried to show a few different options; Using UIImageViews or UIImages, Animations (Which can also be used for the mask).

To sum it all up, you basically have to set the mask property on your view's CALayer. Every UIView subclass has a CALayer attached to it, so you aren't restricted at all in terms of where you get your mask or maskee from. Hope this helped.

Cheers, Dylan.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions