ActionScript3的阿尔法屏蔽? [英] Actionscript3 alpha masking?

查看:194
本文介绍了ActionScript3的阿尔法屏蔽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是想申请在谷歌地图应用程序聚光灯的效果。具体来说,我画一个圆是跟随鼠标,并将其设置为在地图上的面具。这个问题只在圈子内的地图区域显示出来,我知道这是什么面膜应该是什么样子,但有一种方法,使圆以外的区域某种半透明的,这样在它还能在地图看穿?这样,人们仍然可以看到地图的其他部分时,他们只是浏览内圆高亮的区域。谢谢!

I was trying to apply a spotlight effect on a google map application. Specifically, I draw a circle that follows the mouse and set it as a mask over the map. The problem is only the map area within the circle shows up, I know it's what mask is supposed to look like, but is there a way to make the area outside the circle some kind of semi-transparent so that the map under it can also see through? That way people can still see the rest of the map when they navigate just the area within the circle is highlighted. Thanks!

推荐答案

另一种选择是使用blendModes(也可能是多一点昂贵的CPU在某些情况下,但你可以做很多更像是渐变和东西)。 你需要这样的层次结构:

Another option is to use blendModes (it could be a bit more cpu expensive in some cases, but you can do a lot more like gradients and stuff). You need a hierachy like this:

parent clip (blendmode="layer")
   -mask with different alpha values (blendmode="alpha")
   -background image (blendmode="normal")

在你的情况,你有你的地图为背景图像。然后,面具夹内(不要将其设置为面罩)把10%的α形状覆盖整个背景和一个圆形,100%的α-跟随你的鼠标......你甚至可以把一些模糊的圆形,所以你得到一个漂亮的渐变...

In your case, you would have your map as the background image. Then, inside the mask clip (do not set it as mask) put a 10% alpha shape covering the entire background and a circular shape with 100% alpha that follows your mouse... you can even put some blur to the circular shape, so you get a nice gradient...

我前一段时间做了一件很相似,所以我上传的早期测试这里(的fla )如果你想看看:)

I did something very similar some time ago, so I uploaded an early test here (fla) if you want to have a look :)

这篇关于ActionScript3的阿尔法屏蔽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆