Skip to content

Instantly share code, notes, and snippets.

@janit
Last active December 20, 2015 10:24
Show Gist options
  • Save janit/0377d6ee4778f02fdb3d to your computer and use it in GitHub Desktop.
Save janit/0377d6ee4778f02fdb3d to your computer and use it in GitHub Desktop.
// default values for the toggles
var changefont = false;
var colorchanger = false;
var colorfade = false;
var dosinus = true;
// global variables and temporary settings, brrrhhh
var xtmp=0;var msgtmp=0;var doscroll=false;var scrollcount=0;var linecount=0;var runcount=0;var colorcount=0;var font=15;var dir2='up'; var msg=new Array();var controls=false;
// the toggles, needed only for this demo page
function toggle_fontsize() {if (changefont) {changefont = false;} else {changefont = true;}}
function toggle_scroller() {if (doscroll) {doscroll = false;} else {doscroll = true;}}
function toggle_color() {if (colorchanger) {colorchanger = false;} else {colorchanger = true;}}
function toggle_fade() {if (colorfade) {colorfade = false;} else {colorfade = true;}}
function toggle_sinus() {if (dosinus) {dosinus = false;} else {dosinus = true;}}
function init() {
// slice the scroller string into an array
for (var i=0;i <= message.length-1;i++) {
msg[i] = message.charAt(i);
}
// create the character layers
for (var i=0;i <= x;i++) {
document.write('<DIV ID="lyr'+String(i)+'" STYLE="position:absolute; left:'+String(eval(xorigo+xtmp))+'px; top:'+yorigo+'px; font:'+fontstr+'; color:#CCCCCC; font-weight:bold; z-index:2"></DIV>');
xtmp = xtmp + xspace;
if (i == x) {
doscroll = true;
// initiate scroller after evertyhing's fine
scroll();
}
}
}
function settext(charcount) {
// clear existing message, only needed if multiple lines are scrolled, I think
if (lines > 1) {
for (var i=0;i <= x;i++) {
document.getElementById("lyr"+i).innerHTML = '';
}
}
// Full code: http://jsbin.com/telusaqoda/1/embed?html,output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment