How to draw sine waves with HTML5 SVG?

SVGJavascriptWeb DevelopmentFront End Scripts

To draw sine waves with SVG, use the following that closely approximates half of a sine wave. I have used a cubic-bezier approximation. Use the <path> element.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>SVG</title>
      <meta charset = "utf-8" />
   </head>
   <body>
      <h2 align = "center">HTML5 SVG Sine Waves</h2>
      <svg width = "150px" height = "200px" viewBox = "0 0 100 100">
         <path stroke = "#00FF00" fill = "none" d = "M0,0 C36.42,0,70.58,100,100,100" />
      </svg>
   </body>
</html>
raja
Published on 06-Apr-2018 07:47:41
Advertisements