I want to create a “blind rotation” effect on the image so that it “dazzles” and displays.
It seems like this JavaScript transition:
https://github.com/madrobby/scriptaculous - http://madrobby.imtqy.com/scriptaculous/effect-blinddown/
The mask is set correctly, because if I manually change its position, it hides and shows the image behind it, but it does not animate! He just finds himself in the final position of the animation, and you will never see him blind.
Please help! Maybe this is not the best way to achieve the effect of blind fluff?
CALayer *numberLayer = [[CALayer alloc] init];
UIImage *image = [UIImage imageNamed:@"number-7.png"];
numberLayer.contents = (id) [image CGImage];
numberLayer.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
numberLayer.position = position;
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)];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3.0];
[maskLayer setPosition:CGPointMake(0, 50)];
[UIView commitAnimations];
[maskLayer release];
[boardLayer addSublayer:numberLayer];
[numberLayer release];