【发布时间】:2015-12-21 11:34:25
【问题描述】:
如何以编程方式查找我的浏览器是否支持 HTML5 混合模式 (http://www.w3.org/TR/compositing-1/#mix-blend-mode)?
我的代码结构如下
var canvas = document.getElementById("Canvas");
var context = canvas.getContext("2d");
context.fillStyle = "#fff";
context.fillRect(0, 0, canvas.width, canvas.height);
context.globalCompositeOperation = "source-over"
context.globalCompositeOperation = "soft-light";
if (context.globalCompositeOperation){
//browser supports
alert('true');
}
else {
// browser doesn't support
alert('false');
}
但它似乎无法正常工作。即使在 IE 中它也会提醒“真实”。 (http://caniuse.com/#search=blend 表示 IE 不支持混合模式)
【问题讨论】:
-
css
mix-blend-mode与context2d.globalCompositeOperation有点不同
标签: javascript html canvas