我正在尝试产生一种效果,起初整个屏幕都被遮住了。当球在屏幕上移动时,球会揭开它所在的区域,而它所在的区域仍然没有被遮盖。
我有以下代码:
CALayer * ball = [CALayer layer];
ball.bounds = CGRectMake(0, 0, 42, 42);
ball.position = [[[alphabet controls] objectAtIndex:0] CGPointValue];
ball.contents = (id)([UIImage imageNamed:@"done.png"].CGImage);
[self.layer addSublayer:ball];
[self.layer setMask:ball];
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = path;
anim.repeatCount = HUGE_VALF;
anim.duration = 8.0;
[ball addAnimation:anim forKey:@"race"];
这个动画掩盖了整个视图,只显示了球层后面的内容。我的问题是:我怎样才能不掩盖屏幕上显示的部分?