I'm not sure, but if this code works on other PCs under FireFox, maybe you have an old version of the FireFox browser or a call to document.getElementById before the cavas tag with id "layer2" to load. Another problem I noticed was that you are using floating point numbers without a leading zero. For example, 0.5 instead of 0.5. What happens when this code is run?
window.addEventListener("load", function() { var canvas = document.getElementById ( "layer2" ) ; if(!canvas.getContext) { alert("Your browser don't support canvas."); throw new Error("Your browser don't support canvas."); } var context = canvas.getContext ( "2d" ) ; var radgrad2 = context.createRadialGradient( x, y, 15 ,x-30,y-60, 0); radgrad2.addColorStop(0, aux.color , 0.5); radgrad2.addColorStop(0.75, "#ffffff" , 0.5 ); radgrad2.addColorStop(0.5, "#ffffff" , 0.5); context.fillStyle = radgrad2; }, false);
source share