25.04.2025

Переменная

<!DOCTYPE html>
<html>
<head>
    <title>Рисунок</title>
</head>
<body bgcolor="LightGreen">
    <h1>Это canvas</h1>

    <canvas id="namevasya" width="1500" height="1000" style="background: LightCyan;"></canvas>

    <script>
        var canvas = document.getElementById('namevasya');
        var ct = canvas.getContext('2d');

        var x = 200;
        var y = 230;
        var size = 1.1;

        ct.beginPath();

        ct.moveTo(x+600*size,y+200*size);
        ct.lineTo(x+400*size,y+400*size);
        ct.lineTo(x+800*size,y+400*size);
        ct.lineTo(x+600*size,y+200*size);

        ct.stroke();


        ct.beginPath();

        ct.moveTo(x+650*size,y+450*size);
        ct.arc(x+600*size,y+450*size,50*size,0,2*Math.PI);

        ct.stroke();

    </script>
</body>
</html>