J'essaie de créer un effet 'effaceur' dans Canvas, mais en utilisant une image SVG comme forme personnalisée pour la gomme. Donc, je peux dessiner mon image SVG sur le canevas, et utiliser globalCompositeOperation = 'destination-out' pour créer un effet de masquage.Bug Firefox - globalCompositeOperation ne fonctionne pas avec drawImage pour un élément SVG
Cela fonctionne très bien dans IE, Safari et Chrome. Mais il échoue complètement dans Firefox.
\t \t function init() {
\t \t \t var canvas = document.getElementById('c');
\t \t \t var ctx = canvas.getContext('2d');
\t \t \t var img = document.createElement('IMG');
\t \t \t img.onload = function() {
\t \t \t ctx.beginPath();
\t \t \t ctx.drawImage(img, 0, 0);
\t \t \t ctx.closePath();
\t \t \t ctx.globalCompositeOperation = 'destination-out';
\t \t \t }
\t \t \t img.src = "http://www.evanburke.com/FROST.png";
\t \t \t var svg = new Image;
\t \t \t svg.src = "http://www.evanburke.com/luf.svg";
\t \t \t
\t \t \t function drawPoint(pointX,pointY){
\t \t \t ctx.drawImage(svg,pointX,pointY); \t \t
\t \t \t } \t \t \t
\t \t \t canvas.addEventListener('mousemove',function(e){
\t \t \t \t drawPoint(e.clientX,e.clientY);
\t \t \t },false); \t \t \t
\t \t }
\t <body onload="javascript:init();">
\t <div> \t
\t <canvas id="c" width="400" height="400"></canvas>
\t </div>
\t </body>
bug augmentation dans [bugzilla] (https://bugzilla.mozilla.org) alors –