В настоящее время я пытаюсь добавить размытую анимацию на моем представлении для перехода. Я использую каркас GPUImage
, который реализует GPUImageGaussianBlurFilter
.Размытая анимация изображения с использованием GPUImage
Это работает, но эффект применяется к фильтру недостаточно сильным. Я пытаюсь сыграть с значением filter.blurRadiusInPixels
, но, похоже, он не меняет значение, которое я пытаюсь поставить.
Это мой код:
//First I init a ImageView which have the size of the frame of my view
UIImageView * blurredArea = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
//hide this imageView for the moment
blurredArea.alpha = 0;
//In this part I take a snapshot of my current view that I keep in snapshot
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * snapshot=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//Finally I init my GaussianFilter on my snapshot
GPUImageGaussianBlurFilter * filter = [[GPUImageGaussianBlurFilter alloc] init];
UIImage * blurred = [filter imageByFilteringImage: snapshot];
blurredArea.image = blurred;
//Here I define the strength of the blur effect but it seems to do nothing whatever the value is putted.
filter.blurRadiusInPixels = 1;
[self.view addSubview:blurredArea];
[UIView animateWithDuration:0.8f animations:^{
//Animate the blurred imageview alpha but not enough blurred.
blurredArea.alpha = 1;
}
Спасибо, Джири, в следующий раз я посмотрю на это! – AnthonyR