1

我们正在尝试在两个几乎完全相同的图像(几乎是动画帧)之间进行溶解,但到目前为止,我们无法消除在溶解过程中发生的变暗。客户非常坚定地认为没有这种更深的溶解,有什么想法吗?

 UIImageView *newImageView = [[UIImageView alloc] initWithFrame:imageViewSmileDesign.frame];
newImageView.image = imageViewSmileDesign.image;
[self.view addSubview:newImageView];

imageViewSmileDesign.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.jpg", result]];
imageViewSmileDesign.alpha = 0;

[UIView animateWithDuration:0.5 animations:^{
    imageViewSmileDesign.alpha = 1;
    newImageView.alpha = 0;
} completion:^(BOOL finished) {
    [newImageView removeFromSuperview];
} ];

感谢您的关注。

4

4 回答 4

0

You could use the cross-disolve animation that's built into UIView:

+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion

Set options to UIViewAnimationOptionTransitionCrossDissolve.

于 2012-05-10T11:32:52.967 回答
0

只是不要将 'newImageView' 的 alpha 更改为 0。这将导致新图像在旧图像之上褪色,并且您没有这种中途状态,它们都是半透明的,显示背景颜色。

您必须在动画之前imageViewSmileDesign调用 to 将其带到最前面。bringSubviewToFront:

于 2012-05-10T11:43:04.753 回答
0

如果两个图像具有相同的框架,只需删除newImageView.alpha = 0;. 这样就行了。

于 2012-05-10T11:43:30.387 回答
0

您需要延迟 newImageView.alpha 淡入淡出的 START。

于 2015-06-29T06:54:44.837 回答