Advertisement
KMortazaee

Draw Parabola by JS_2

May 26th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.83 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width">
  6.   <title>Draw Parabola by JS (2)</title>
  7. </head>
  8. <body>
  9. <script>
  10.         var _max = 500;
  11.         var _counter = 0;
  12.         var _step = 20;
  13.  
  14.         document.write("<svg class=rainbow xmlns=svg xmlns:xlink=http://www.w3.org/2000/svg width=1000 height=1000>");
  15.         for ( _counter = 0 ; _counter < _max ; _counter = _counter + _step) {
  16.         var _r =  _counter;
  17.         var _g =  ( _counter * 10 ) % 255;
  18.         var _b =  ( _counter * 100 ) % 255;
  19.  
  20.                document.write("<line x1=0 y1=" + _counter + " x2=" + _counter + " y2=" + _max + " ");
  21.                document.write("style='stroke:rgb(" + _r + "," + _g + "," + _b + ");stroke-width:2;'></line>");
  22.         }
  23.  
  24.         document.write("</svg>");
  25. </script>
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement