画布动态fillStyle hsl颜色不起作用?

Hir*_*ker 2 javascript canvas

我必须使用hsl使用动态颜色,但它不起作用.这是我的代码

HTML:

<html>
<head >
    <script type="text/javascript" src="canvases.js"></script>
</head>
<body>
    <canvas height="800" width="800"></canvas>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

(function(){

    function init(){
        var canvas = document.getElementsByTagName('canvas')[0];
        var c = canvas.getContext('2d');
        var x = 100;
        var y = 100;
        function draw(){
            c.clearRect(0,0,canvas.width, canvas.height);
            c.fillStyle = 'black';
            c.clearRect(0,0,canvas.width, canvas.height);

            for(var i=0; i<5; i++){
                var r= 50*Math.random();
                c.fillStyle = 'hsl('+ 360*Math.random() +',100%,500%)';
                c.beginPath();
                c.arc(1000*Math.random(),1000*Math.random(),r,0,2*Math.PI,false);
                c.fill();
            }
            requestAnimationFrame(draw);

        }
        draw();

    }

    window.addEventListener('load',init,false);
}());
Run Code Online (Sandbox Code Playgroud)

没有显示任何错误但无法返回任何内容.

mar*_*rkE 11

错字!

// not 500%
c.fillStyle = 'hsl('+ 360*Math.random() +',100%,50%)';
Run Code Online (Sandbox Code Playgroud)