1. 程式人生 > >用svg的折線(polyline)繪製一顆五角星

用svg的折線(polyline)繪製一顆五角星

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<svg width="700" height="700" style="background-color: #dddddd" id="s1"></svg>
<script>
    var s1=document.getElementById("s1")
    var html=""
    html=`<polyline points="0,170 484,170 88,440 240,4 391,439 0,170" fill-opacity="0.7" fill="red"></polyline>`
    s1.innerHTML=html
</script>
</body>
</html>