Merged some nasty programs from softz.harvie.cz
[mirrors/Programs.git] / php / websin / websin.php
diff --git a/php/websin/websin.php b/php/websin/websin.php
new file mode 100755 (executable)
index 0000000..4098d8b
--- /dev/null
@@ -0,0 +1,112 @@
+<title>SinusCurve - (c) Harvie 2oo6</title>\r
+\r
+<style>\r
+  body { background-color: black; color: lime; font-family: Arial, Tahoma; }\r
+  #hide { border: 2px solid; color: white; margin: 10px; padding: 10px; }\r
+  #sipka {float: right;}\r
+  pre { line-height: 20%; letter-spacing: 0%; word-spacing: 0%; }\r
+@media print {\r
+  #hide { border: none; height: 0px; overflow: hidden; color: red; }\r
+  body { background-color: white; color: black; font-family: Arial, Tahoma;}\r
+}\r
+</style>\r
+\r
+<h2>f:Y = sin(X)</h2>\r
+\r
+<div id="hide">\r
+<form action="#" method="get">\r
+<b>Settings:</b><br /><br />\r
+X-Min: <input type="text" name="start" value="0"> = First X<br />\r
+X-Max:<input type="text" name="reset" value="<? echo(2*PI()); ?>"> = Last X<br />\r
+Step: <input type="text" name="step" value="0.07"> = Increase X by this every line.<br /><br />\r
+\r
+Y-Offset: <input type="text" name="offset" value="1.1"> = Displacement on Y (0 = half sinewave; 1.1 = whole sinewave)<br />\r
+Width:<input type="text" name="width" value="35"> = Y Zoom<br />\r
+Zoom: <input type="text" name="zoom" value="1"> = X Zoom (Every line will be printed this much times.)<br /><br />\r
+\r
+Outline: <input type="text" name="outline" value="+"> = Curve outline (try: "#")<br />\r
+Inlay: <input type="text" name="inlay" value=" "> = Curve inlay (try: ":")<br /><br />\r
+\r
+<i>\r
+Tips:<br />\r
+Press CTRL+A<br />\r
+Press CTRL and try to roll MouseWheeeel...<br />\r
+Look at source code of this webpage ;)<br />\r
+</i><br />\r
+\r
+<input type="submit" value=".: DRAW :.">\r
+</form>\r
+</div>\r
+<pre><?php\r
+//This will draw the ASCII "neverending" sinus curve.\r
+//Writen by (c) Harvie in 2oo6\r
+\r
+//Settings:\r
+$start = 0;     //0 //First X\r
+$step = 0.07;    //0.1 //Increase X on every line by this number\r
+$reset = (2*PI()); //When X >= reset, then it will be reseted to zero\r
+$zoom = 1;      //1 //This will repeat every line few times\r
+$offset = 1.1;    //1.1 //1 //0 -> Zero offset will draw only half of sin curve.\r
+$width = 35;     //20 //35 //40 //This will stretch every line.\r
+$sleep = "0";   //15000 - Wait between lines in microseconds\r
+$line = (" ");     // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).\r
+$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
+\r
+//Read settings from form:\r
+if ($_GET["start"] != "") {\r
+  $start = $_GET["start"];}\r
+if ($_GET["reset"] != "") {\r
+  $reset = $_GET["reset"];}\r
+if ($_GET["step"] != "") {\r
+  $step = $_GET["step"];}\r
+\r
+if ($_GET["offset"] != "") {\r
+  $offset = $_GET["offset"];}\r
+if ($_GET["width"] != "") {\r
+  $width = $_GET["width"];}\r
+if ($_GET["zoom"] != "") {\r
+  $zoom = $_GET["zoom"];}\r
+\r
+if ($_GET["outline"] != "") {\r
+  $endline = ($_GET["outline"]."<br />\n");}\r
+if ($_GET["inlay"] != "") {\r
+  $line = $_GET["inlay"];}\r
+\r
+//Code:\r
+echo ("[SinusCurve]-[c][Harvie][2oo6]<br />\n<br />\n");\r
+echo (" |                                                                            y<br />\n");\r
+echo ("-+-----------------------------------------------------------------------------><span id=\"sipka\">-------> Y ></span><br />\n");\r
+echo ("x|<br />\n");\r
+echo (" V<br /><br />\n<small>\n");\r
+\r
+//sleep(2);\r
+\r
+$pos = $start;\r
+while(1) {\r
+\r
+  //usleep($sleep); //Wait in microseconds\r
+  \r
+  $znaku = ((sin($pos) + $offset) * $width);\r
+  \r
+  $zoom2 = $zoom;\r
+  while ($zoom2 > 0) {\r
+  \r
+    $znaku2 = round($znaku); //It looks better after round ;)\r
+    while ($znaku2 > 0) {\r
+      echo $line;\r
+      $znaku2 = ($znaku2 - 1);\r
+    }\r
+    //echo(" ".$pos); //Debug\r
+    echo ($endline);\r
+    \r
+    $zoom2 = ($zoom2 - 1);\r
+  }\r
+  \r
+  $pos = ($pos + $step);\r
+  if ($pos >= $reset) {\r
+    $pos = 0;\r
+    die();\r
+  }\r
+\r
+}\r
+?></pre></small>\r
This page took 0.113922 seconds and 4 git commands to generate.