Actionscript3 alpha 蒙版? [英] Actionscript3 alpha masking?

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

问题描述

我试图在谷歌地图应用程序上应用聚光灯效果.具体来说,我绘制了一个跟随鼠标的圆圈并将其设置为地图上的蒙版.问题是只显示圆圈内的地图区域,我知道这是蒙版应该是什么样子的,但是有没有办法使圆圈外的区域成为某种半透明的,这样它下面的地图也可以看穿?这样人们在导航时仍然可以看到地图的其余部分,只是突出显示了圆圈内的区域.谢谢!

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% alpha 形状和一个跟随鼠标的 100% alpha 的圆形...你甚至可以给圆形添加一些模糊,所以你会得到一个很好的渐变......

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 alpha 蒙版?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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