带有透明 UIImageView 的卷页动画(iOS)
我有一条丝带(书签),我想将其卷曲到屏幕之外。功能区底部有一个 V 形切口,这是一个透明部分 - 带有透明 png 的 UIImageView。
当我在功能区上执行卷曲操作时,下面的阴影代表整个视图(技术上是正方形的)。我正在努力让这看起来尽可能真实,所以如果有人能给我指出正确的方向,那将会很有帮助。
我已经尝试过 - 遮蔽视图 - 调整开源页面卷曲框架 - 在卷页期间替换 viewAtIndex - UIView 动画
,但它们都会产生方形阴影。
到目前为止,我可以提供的最佳体验是一个简单的 UIView 动画,同时淡出:
[UIView transitionWithView:_ribbonButton
duration:0.5f
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
[_ribbonButton setAlpha:0.0f];
}
completion:^(BOOL completed){
[self animationCompleted:completed];
}];
I have a ribbon (bookmark) that I want to curl up, off of the screen. The ribbon has a V cut out of the bottom, which is a transparent section - a UIImageView with a transparent png.
When I perform a curl on the ribbon, the underlying shadow represents the entire View (which is technically square). I am trying to make this look as real as possible so if someone could point me in the right direction, that would be helpful.
I have tried
- masking the view
- tweaking open source page curl frameworks
- replacing the viewAtIndex during a page curl
- UIView animations
but they all result in a square shadow.
The best experience I can provide so far is a simple UIView animation while fading out the:
[UIView transitionWithView:_ribbonButton
duration:0.5f
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
[_ribbonButton setAlpha:0.0f];
}
completion:^(BOOL completed){
[self animationCompleted:completed];
}];
Here is an screenshot: http://livevision.us/wordpress/?attachment_id=60
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为使用 UIViewAnimationOptionTransitionCurlUp 不可能做到这一点。视图动画基于整个视图边界,而不是视图的内容。
我认为你必须自己用 OpenGL 或预渲染的翻转动画或其他东西编写一些代码。您可以下载许多现有的 OpenGL 解决方案 并定制。
I don't think that will be possible using UIViewAnimationOptionTransitionCurlUp. The view animations are based on the entire view bounds, not the contents of the view.
I think you will have to code something yourself in OpenGL or a pre-rendered flip animation or something else. There are a number of existing OpenGL solutions you can download and customize.