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