Added lot of junk laying around on harvie.cz
[mirrors/Programs.git] / php / skripty / sinus_curve.php
diff --git a/php/skripty/sinus_curve.php b/php/skripty/sinus_curve.php
new file mode 100644 (file)
index 0000000..181ab85
--- /dev/null
@@ -0,0 +1,55 @@
+<?php\r
+//This will draw the ASCII neverending sinus curve.\r
+//Writen by (c) Harvie in 2oo6\r
+//This is script for PHP CLI (Not WebPage).\r
+//You can port it to web by replacing "/n" by "<br>/n"\r
+\r
+//Settings:\r
+$start = 0;     //0 //First X\r
+$step = 0.1;    //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 = "15000";   //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 = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline).\r
+\r
+//Code:\r
+echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n");\r
+echo ("0|                                           y\n");\r
+echo ("-|--------------------------------------------->\n");\r
+echo ("x|\n");\r
+echo (" V\n\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
+  //echo(" ".$pos." "); //Debug\r
+  $pos = ($pos + $step);\r
+  if ($pos >= $reset) {\r
+    $pos = 0;\r
+  }\r
+\r
+}\r
+?>\r
This page took 0.099532 seconds and 4 git commands to generate.