| 1 | <title>SinusCurve - (c) Harvie 2oo6</title>\r |
| 2 | \r |
| 3 | <style>\r |
| 4 | body { background-color: black; color: lime; font-family: Arial, Tahoma; }\r |
| 5 | #hide { border: 2px solid; color: white; margin: 10px; padding: 10px; }\r |
| 6 | #sipka {float: right;}\r |
| 7 | pre { line-height: 20%; letter-spacing: 0%; word-spacing: 0%; }\r |
| 8 | @media print {\r |
| 9 | #hide { border: none; height: 0px; overflow: hidden; color: red; }\r |
| 10 | body { background-color: white; color: black; font-family: Arial, Tahoma;}\r |
| 11 | }\r |
| 12 | </style>\r |
| 13 | \r |
| 14 | <h2>f:Y = sin(X)</h2>\r |
| 15 | \r |
| 16 | <div id="hide">\r |
| 17 | <form action="#" method="get">\r |
| 18 | <b>Settings:</b><br /><br />\r |
| 19 | X-Min: <input type="text" name="start" value="0"> = First X<br />\r |
| 20 | X-Max:<input type="text" name="reset" value="<? echo(2*PI()); ?>"> = Last X<br />\r |
| 21 | Step: <input type="text" name="step" value="0.07"> = Increase X by this every line.<br /><br />\r |
| 22 | \r |
| 23 | Y-Offset: <input type="text" name="offset" value="1.1"> = Displacement on Y (0 = half sinewave; 1.1 = whole sinewave)<br />\r |
| 24 | Width:<input type="text" name="width" value="35"> = Y Zoom<br />\r |
| 25 | Zoom: <input type="text" name="zoom" value="1"> = X Zoom (Every line will be printed this much times.)<br /><br />\r |
| 26 | \r |
| 27 | Outline: <input type="text" name="outline" value="+"> = Curve outline (try: "#")<br />\r |
| 28 | Inlay: <input type="text" name="inlay" value=" "> = Curve inlay (try: ":")<br /><br />\r |
| 29 | \r |
| 30 | <i>\r |
| 31 | Tips:<br />\r |
| 32 | Press CTRL+A<br />\r |
| 33 | Press CTRL and try to roll MouseWheeeel...<br />\r |
| 34 | Look at source code of this webpage ;)<br />\r |
| 35 | </i><br />\r |
| 36 | \r |
| 37 | <input type="submit" value=".: DRAW :.">\r |
| 38 | </form>\r |
| 39 | </div>\r |
| 40 | <pre><?php\r |
| 41 | //This will draw the ASCII "neverending" sinus curve.\r |
| 42 | //Writen by (c) Harvie in 2oo6\r |
| 43 | \r |
| 44 | //Settings:\r |
| 45 | $start = 0; //0 //First X\r |
| 46 | $step = 0.07; //0.1 //Increase X on every line by this number\r |
| 47 | $reset = (2*PI()); //When X >= reset, then it will be reseted to zero\r |
| 48 | $zoom = 1; //1 //This will repeat every line few times\r |
| 49 | $offset = 1.1; //1.1 //1 //0 -> Zero offset will draw only half of sin curve.\r |
| 50 | $width = 35; //20 //35 //40 //This will stretch every line.\r |
| 51 | $sleep = "0"; //15000 - Wait between lines in microseconds\r |
| 52 | $line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).\r |
| 53 | $endline = ("+<br />\n"); // "#<br />\n" // ".<br />\n" //chr ( 219 )."<br />\n" //This is the string, that will be printed at end of every line (curve outline).\r |
| 54 | \r |
| 55 | //Read settings from form:\r |
| 56 | if ($_GET["start"] != "") {\r |
| 57 | $start = $_GET["start"];}\r |
| 58 | if ($_GET["reset"] != "") {\r |
| 59 | $reset = $_GET["reset"];}\r |
| 60 | if ($_GET["step"] != "") {\r |
| 61 | $step = $_GET["step"];}\r |
| 62 | \r |
| 63 | if ($_GET["offset"] != "") {\r |
| 64 | $offset = $_GET["offset"];}\r |
| 65 | if ($_GET["width"] != "") {\r |
| 66 | $width = $_GET["width"];}\r |
| 67 | if ($_GET["zoom"] != "") {\r |
| 68 | $zoom = $_GET["zoom"];}\r |
| 69 | \r |
| 70 | if ($_GET["outline"] != "") {\r |
| 71 | $endline = ($_GET["outline"]."<br />\n");}\r |
| 72 | if ($_GET["inlay"] != "") {\r |
| 73 | $line = $_GET["inlay"];}\r |
| 74 | \r |
| 75 | //Code:\r |
| 76 | echo ("[SinusCurve]-[c][Harvie][2oo6]<br />\n<br />\n");\r |
| 77 | echo (" | y<br />\n");\r |
| 78 | echo ("-+-----------------------------------------------------------------------------><span id=\"sipka\">-------> Y ></span><br />\n");\r |
| 79 | echo ("x|<br />\n");\r |
| 80 | echo (" V<br /><br />\n<small>\n");\r |
| 81 | \r |
| 82 | //sleep(2);\r |
| 83 | \r |
| 84 | $pos = $start;\r |
| 85 | while(1) {\r |
| 86 | \r |
| 87 | //usleep($sleep); //Wait in microseconds\r |
| 88 | \r |
| 89 | $znaku = ((sin($pos) + $offset) * $width);\r |
| 90 | \r |
| 91 | $zoom2 = $zoom;\r |
| 92 | while ($zoom2 > 0) {\r |
| 93 | \r |
| 94 | $znaku2 = round($znaku); //It looks better after round ;)\r |
| 95 | while ($znaku2 > 0) {\r |
| 96 | echo $line;\r |
| 97 | $znaku2 = ($znaku2 - 1);\r |
| 98 | }\r |
| 99 | //echo(" ".$pos); //Debug\r |
| 100 | echo ($endline);\r |
| 101 | \r |
| 102 | $zoom2 = ($zoom2 - 1);\r |
| 103 | }\r |
| 104 | \r |
| 105 | $pos = ($pos + $step);\r |
| 106 | if ($pos >= $reset) {\r |
| 107 | $pos = 0;\r |
| 108 | die();\r |
| 109 | }\r |
| 110 | \r |
| 111 | }\r |
| 112 | ?></pre></small>\r |