【发布时间】:2014-09-20 14:59:39
【问题描述】:
我正在考虑按照这里所做的方式做一些事情:
http://viget.com/extend/masking-video-tags-using-html5-canvas
其中 globalCompositeOperation 用于设置遮罩区域。
function drawMaskedVideo() {
ctx.save();
// Draw the video feed
ctx.drawImage(video, 0, 0);
// Set the composite operation, which is responsible for masking
// see https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html
ctx.globalCompositeOperation = 'destination-in';
// Apply the mask
ctx.drawImage(mask, 0, 0);
ctx.restore();
}
requestAnimationFrame(function loop() {
requestAnimationFrame(loop.bind(this));
drawMaskedVideo();
});
但是我不确定这将如何与 createjs 集成,有没有人在 createjs 中看到它,我没有找到任何示例,尽管我确实注意到位图源可以是视频。 http://www.createjs.com/Docs/EaselJS/classes/Bitmap.html
【问题讨论】:
标签: javascript html canvas easeljs createjs