0

我试图通过将光栅应用于 CALayer 来执行快速而肮脏的“模糊”。CA 文档说 shouldRasterize 是可动画的,但是我没有得到任何动画。下面的代码:

 CABasicAnimation* blurAnimation;
 blurAnimation = [CABasicAnimation animationWithKeyPath:@"rasterize"];
 blurAnimation.removedOnCompletion = NO;
 blurAnimation.autoreverses = YES;
 blurAnimation.duration = 3.0f;
 blurAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];    
 blurAnimation.repeatCount = 20; // HUGE_VALF;
blurAnimation.fromValue = [NSNumber numberWithFloat:0.3f];
blurAnimation.toValue = [NSNumber numberWithFloat:1.0f];
[theCheck setShouldRasterize:YES];

 // Add animation to the layer and make it so
 [theCheck addAnimation:blurAnimation forKey:nil];   
4

1 回答 1

2

您是否尝试将“rasterize”更改为“rasterizationScale”?

于 2012-04-24T20:35:13.283 回答