Actionscript3 alpha masking?

后端 未结 3 661
名媛妹妹
名媛妹妹 2021-01-07 06:54

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

3条回答
  •  庸人自扰
    2021-01-07 07:09

    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")
    

    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...

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

提交回复
热议问题