2 opposite opacity values dont produce opaque color

帅比萌擦擦* 提交于 2019-12-08 02:51:43

问题


I want to produce an opaque solid color with 2 opacity values of that color.

eg: 0.5 opacity black color rectangle when placed above same 0.5 opacity black color doesn't give me same result as an opaque (opacity 1) black color.

I have tried this with different range of opacity values and found something like 0.5 & 0.8 produce 0.9 opacity black color, 0.4 & 0.82 and so on.

These are not accurate values. What is the exact formula for calculating exactly opposite opacity values?


回答1:


If two elements with opacity 1-a and 1-b are stacked on top of each other, their combined opacity will be 1-a*b, so there's no such thing as "opposite opacity values". If you want two elements combined to be fully opaque, then one of them has to be fully opaque itself.

This mimics the real world as well: when you stack two dark foils that each absorbs 50% of light passing through, their combined opacity is 75%, not 100%. Three foils - 87.5% and so on.



来源:https://stackoverflow.com/questions/13190432/2-opposite-opacity-values-dont-produce-opaque-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!