iPhone - 在UIImageView上具有Ripple效果

问题描述 投票:8回答:5

我试图在它被触及时在imageView上创建一个类似波纹的效果,但是我不明白如何为Windows实现OpenGL并将其移植到iOS。我试图使用http://www.codeproject.com/KB/openGL/dsaqua.aspx以及cocos2d但是我发现后者完全和完全混淆。有人愿意提出一些建议或者能指出我正确的方向吗?

非常感谢!

iphone uiimageview image-manipulation ripple
5个回答
7
投票

使用下面的iPhone中的涟漪效果

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:(UIViewAnimationTransition) 110 forView:view cache:NO];
[UIView commitAnimations];

要获得更多效果,您可以查看以下链接:

http://www.iphonedevwiki.net/index.php?title=UIViewAnimationState


48
投票

如果您想在视图上产生涟漪效果,可以使用它。

    CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:2.0f];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:@"rippleEffect" ];
[myView.layer addAnimation:animation forKey:NULL];

7
投票

@Rony在Swift中的CATransition Ripple

let animation = CATransition()
animation.delegate = self
animation.duration = 2
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
animation.type = "rippleEffect"
myView.layer.addAnimation(animation, forKey: nil)

(这是我的第一篇文章,如果我做得对,那就是idk:D)


3
投票

对于Swift 3.0

let animation = CATransition()
animation.delegate = self
animation.duration = 5.0
animation.timingFunction = CAMediaTimingFunction(name : kCAMediaTimingFunctionEaseInEaseOut)
animation.type = "rippleEffect"
viewForAnimation.layer.add(animation, forKey: nil)

1
投票

我已经尝试了上面提到的代码,但没有一个完美。找出以下源代码。 https://github.com/willstepp/gl_image_ripple

© www.soinside.com 2019 - 2024. All rights reserved.