Created
October 31, 2012 21:55
-
-
Save JSkally/3990178 to your computer and use it in GitHub Desktop.
ascii.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function playAnimation() { | |
frameStr = document.getElementById("frameArea").value; | |
if (frameStr.indexOf("\r\n") != -1) { | |
frameSeq = frameStr.split("=====\r\n"); | |
} | |
else { | |
frameSeq = frameStr.split("=====\n"); | |
} | |
currentFrame = 0; | |
showNextFrame(); | |
} | |
function showNextFrame() { | |
document.getElementById("displayArea").value = frameSeq[currentFrame]; | |
currentFrame = (currentFrame+1) % frameSeq.length; | |
timer = setTimeout("showNextFrame();", 350); | |
} | |
function stopAnimation() { | |
clearTimeout(timer); | |
} | |
function clearFrame() { | |
document.getElementById("displayArea").value = ''; | |
} | |
function selectAni () { | |
document.getElementById("frameArea").value = ANIMATIONS[document.getElementById("animation").value] | |
}function playAnimation() { | |
frameStr = document.getElementById("frameArea").value; | |
if (frameStr.indexOf("\r\n") != -1) { | |
frameSeq = frameStr.split("=====\r\n"); | |
} | |
else { | |
frameSeq = frameStr.split("=====\n"); | |
} | |
currentFrame = 0; | |
showNextFrame(); | |
} | |
function showNextFrame() { | |
document.getElementById("displayArea").value = frameSeq[currentFrame]; | |
currentFrame = (currentFrame+1) % frameSeq.length; | |
timer = setTimeout("showNextFrame();", 350); | |
} | |
function stopAnimation() { | |
clearTimeout(timer); | |
} | |
function clearFrame() { | |
document.getElementById("displayArea").value = ''; | |
} | |
function selectAni () { | |
document.getElementById("frameArea").value = ANIMATIONS[document.getElementById("animation").value] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>ASCII Animation</title> | |
<script type="text/javascript" src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/6/animations.js"></script> | |
<script type="text/javascript" src="ascii.js"> </script> | |
</head> | |
<body style="text-align:center" cz-shortcut-listen="true"> | |
<h2>ASCII Animation Editor/Viewer</h2> | |
<table> | |
<tbody> | |
<tr> | |
<td style="text-align:center"> | |
Enter the frames below, separated by "<code>=====</code>". | |
</td> | |
<td style="text-align:center"> | |
<input type="button" value="Play the Animation" onclick="playAnimation();"> | |
<input type="button" value="Stop" onclick="stopAnimation();"> | |
<input type="button" value="Clear screen" onclick="clearFrame();"> | |
<select id = "animation" onchange = "selectAni();"> | |
<option></option> | |
<option value = "BIKE">Biker</option> | |
<option value = "Juggler">Juggler</option> | |
<option value = "Dive">Diver</option> | |
</select> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<textarea id="frameArea" rows="25" cols="55" style="font-size:8pt"> | |
o | |
/#\ | |
_|_ | |
===== | |
\o/ | |
# | |
_/ \_ | |
</textarea> | |
</td> | |
<td> | |
<textarea id="displayArea" rows="25" cols="55" style="font-size:8pt"></textarea> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment