iphone - 滑动动画
我有一个 UIView,我想通过以下方式将其动画显示到屏幕上:
想象一下,您正在看一个桌面,并且有一个信封,在信封上方有一个盒子。该框几乎覆盖了整个信封,但您会看到一个没有被框覆盖的小信封边框。动画将是信封向下滑动,直到完全可见。
我可以简单地对此进行动画处理,但我必须在信封上有另一个带有框图像的视图,因此它将覆盖信封。我的想法是在没有此框视图的情况下进行此操作。如果我使用像 Photoshop 这样的应用程序来制作动画,我只需将遮罩(或蒙版)固定,并在我希望信封不可见的地方制作一个黑色矩形,即模拟它被盒子覆盖的情况。然后,如果我保持蒙版固定,我可以为图像设置动画,它会显示为来自框下方,但实际上它来自遮罩为黑色(图像不可见)的区域到伴侣是白色的(图像可见)。
在 iOS 上可以做到这一点吗?
我可以遮罩 UIImageView 或图层并为图层设置动画并保持其遮罩固定吗?
在此页面查看下滑效果 http://madrobby.github.com/scriptaculous/combination-effects-demo/
它会让你明白我的意思...
谢谢
I have a UIView that I would like to animate into the screen in the following way:
Imagine you are looking a table top and you have an envelop and over that envelop a box. The box covers almost all the envelop, but you see a small envelop border that is not covered by the box. The animation would be the envelop sliding down until it is fully visible.
I could simple animate this, but I would have to have another view with the box image, over the envelop, so it will cover the envelop. My idea is to make this without this box view. If I was using an application like Photoshop to animate this, I would simply make the matte (or mask) fixed and make a black rectangle where I want the envelop to be invisible, that is, to simulate as it was covered by the box. Then, if I keep the mask fixed, I can animate the image and it will appear as it is coming from below the box, but in fact it is coming from a region where the matte is black (image is invisible) to a region where the mate is white (image is visible).
Is it possible to do this on iOS?
Can I mask a UIImageView or layer and animate the layer keeping its mask fixed?
Check the slide down effect here in this page
http://madrobby.github.com/scriptaculous/combination-effects-demo/
It will give you and idea of what I mean...
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将“遮罩视图”的
clipsToBounds
属性设置为YES
。将“内容视图”作为子视图添加到“蒙版视图”中,并对“内容视图”的框架进行动画处理,使其滑入蒙版中。Set the
clipsToBounds
-property of the 'mask view' toYES
. Add your 'content view' as subview to the 'mask view' and animate the frame of the 'content view' so that it slides into the mask.