Is the canvas color transparent gradient inconsistent on Firefox and Chrome?

made a graded background color (translucent), but the display is inconsistent on Firefox and Chrome. Am I missing something?

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<style type="text/css">
body{background: -sharp000;}
</style>
</head>
<body>
    <div style="padding: 50px;">
        <canvas id="myCanvas" width="400px" height="200px"></canvas>
    </div>
    <script type="text/javascript">
        drawCnvas(document.getElementById("myCanvas"));
        function drawCnvas(obj){
            var ctx = obj.getContext("2d");
            var ht = obj.height;
            var wt = obj.width;
            var my_gradient = ctx.createLinearGradient(0,0,0,ht);
            my_gradient.addColorStop(0,"rgba(0, 255, 255, 0.5)");
            my_gradient.addColorStop(1,"rgba(0,0,0,0)");
            ctx.fillStyle = my_gradient;
            ctx.fillRect(0,0,wt,ht);
        }
    </script>
</body>
</html>

Firefox version 61.0.1
Chrome version 67.0.3396.99

Firefox

Chrome

Mar.29,2021

after testing, firefox's implementation of LinearGradient is different.
firefox seems to calculate the color of the beginning and end (with a black background with the value of the alpha transparency channel), and then calculate the transition color in the middle by linear, and then calculate the change of alpha separately (this should be the wrong calculation method).
while chrome is based on the RGBA value of the 4 channels of rgba, and linear calculates the RGBA value of the transition part to get the color of the transition part
https://jsfiddle.net/m39n4d8v.

.
Menu