Drawing sine waves with HTML5


To draw sine waves with HTML5, use SVG.

Use the following that closely approximates half of a sine wave. I have used a cubic bezier approximation.

<!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>
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements