移动设备的透明视频或动画?

时间:2014-12-22 11:16:29

标签: animation video canvas transparent device

有没有办法为html图层实现透明视频......或者为移动设备实现透明动画。 我尝试使用canvas来缓冲像这样的视频:

 var outputCanvas = document.getElementById('output'),
            output = outputCanvas.getContext('2d'),
            bufferCanvas = document.getElementById('buffer'),
            buffer = bufferCanvas.getContext('2d'),
            video = document.getElementById('video'),
            width = outputCanvas.width,
            height = outputCanvas.height,
            interval;

    function processFrame() {
        buffer.drawImage(video, 0, 0);

        // this can be done without alphaData, except in Firefox which doesn't like it when image is bigger than the canvas
        var image = buffer.getImageData(0, 0, width, height),
                imageData = image.data,
                alphaData = buffer.getImageData(0, height, width, height).data;

        for (var i = 3, len = imageData.length; i < len; i = i + 4) {
            imageData[i] = alphaData[i-1];
        }

        output.putImageData(image, 0, 0, 0, 0, width, height);
    }

http://jakearchibald.com/scratch/alphavid/ 但它不适用于手机...... 做这样的事情但是在电话上工作的任何方法?

0 个答案:

没有答案