Я хочу создать эффект «слепой» на изображении, чтобы изображение «ослеп» и появляется.Ослепляющая анимация на CALayer с использованием маски
Вроде как этот переход JavaScript: http://wiki.github.com/madrobby/scriptaculous/effect-blinddown
Маска настроена правильно, потому что если я вручную изменить это положение скрывает и показывает изображение позади него, но он не живой! Он просто заканчивается в оживляющей конечной позиции, и вы никогда не увидите его фактическим слепым.
Пожалуйста, помогите! Может быть, это не лучший способ добиться эффекта слепого?
// create a new layer
CALayer *numberLayer = [[CALayer alloc] init];
// render the number "7" on the layer
UIImage *image = [UIImage imageNamed:@"number-7.png"];
numberLayer.contents = (id) [image CGImage];
numberLayer.bounds = CGRectMake(0, 0, image.size.width, image.size.height); // width and height are 50
numberLayer.position = position;
// create a new mask that is 50x50 the size of the image
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, nil, CGRectMake(0, 0, 50, 50));
[maskLayer setPath:path];
[maskLayer setFillColor:[[UIColor whiteColor] CGColor]];
[theLayer setMask:maskLayer];
[maskLayer setPosition:CGPointMake(0, 0)]; // place the mask over the image
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3.0];
[maskLayer setPosition:CGPointMake(0, 50)]; // slide mask off the image
// this should shift the blind away in an animation
// but it doesn't animate
[UIView commitAnimations];
[maskLayer release];
[boardLayer addSublayer:numberLayer];
[numberLayer release];
Вы когда-нибудь узнали ответ на этот вопрос? – FreeAsInBeer