El sitio más completo sobre programación, recursos web y herramientas online para Webmasters
Fecha: 04/08/2005

Luminoso javascript

Esta sencilla rutina simula a un cartel electronico, en donde aparece un mensaje que se desplaza de una extremo a otro.

Código Javascript


<html>
<head><title>Luminoso</title>
<script language="JavaScript1.1">
<!--
/*
Luminoso: vs.0.1
Version adaptada, mejorada y ampliada
del script JSLed, de M.Ishii
http://130.54.49.90/cgi-bin/kubotaE.html
*/

// ************************
// Parametros modificables:
// ************************
//Colores:
activado="ejemplos/verde.gif"; //luminoso activado (imagen 1x1 pixel)
apagado ="ejemplos/negro.gif"; //luminoso apagado (imagen 1x1 pixel)
cambiar = 0; //cambiar=0 -> colores normales
//cambiar=1 -> invertimos colores
//Velocidad:
repet=0; //Numero de repeticiones: 0 para infinitas.
veloc= 180; //A mayor veloc, mas rapido se mueve.
//Separaciones:
//para obtener letras solidas, poner a 0 las tres distancias.
distanciaPaneles= 0; //Separacion entre paneles (border)
distancia_A= 0; //Separacion cellpadding entre paneles luminosos
distancia_B= 1; //Separacion cellspacing entre paneles luminosos
//Tamanios:
numLetras= 4; //num de letras
anchuraLetras= 15; //puede modificarse sin problemas
alturaLetras = 10; //puede modificarse sin problemas
//Colores:
colorFondo= "blue"; //color de separacion de paneles
colorBorde= "red"; //color del borde (si lo hay)
// ********************************
// FIN de Parametros modificables *
// ********************************
width = numLetras*5; //num. de paneles en anchura
height= 5; //num. de paneles en altura
//Aqui almacenamos las letras:
txt= new Array(height);
for(i=1;i<=height;i++) {
txt[i]="";
for(j=1;j<=width;j++) {
txt[i]="0"+txt[i];
}
}
//Construimos el luminoso
var text = "<center>";
text += "<table bgcolor="+colorFondo+" ";
text += "cellpadding="+distancia_A+" ";
text += "cellspacing="+distancia_B+" ";
text += "border="+distanciaPaneles+" ";
text += "bordercolor="+colorBorde+"><tr>";
for(i=1;i<=height;i++){
for(j=1;j<=width;j++){
text += "<td><img width="+anchuraLetras+" ";
text += "height="+alturaLetras+" ";
text += "src='"+apagado+"'>";
}
if(i!=width){
text += "<tr>"; //siguiente linea
}
}
text += "</table></center>";
document.write (text);
//Precarga de imagenes
onoff= new Array();
onoff[0]=new Image();
onoff[1]=new Image();
onoff[0].src= (cambiar==0)?apagado:activado;
onoff[1].src= (cambiar==0)?activado:apagado;
arranynum= width*height-1; //numero de paneles/imagenes


var ancho;
//Funciones:
function Rotar(){
for(i=1;i<=height;i++) {
txt[i]= txt[i].substring(1,ancho)+txt[i].substring(0,1);
}
}
function Panel(){
//--------------------------------------
//Enciende/Apaga cada uno de los paneles
//--------------------------------------
cont=0;
for(j=1;j<=width;j++) {
for (var k=1;k<=height;k++) {
flagf= txt[k].substring(cont,cont+1);
flag = txt[k].substring(cont+1,cont+2);
if(flag != flagf){
document.images[cont+width*(k-1)].src= onoff[flag].src;
}
}
cont= (j-1)%width+1;
}
Rotar();
repet--;
if(repet != 0){
setTimeout("Panel()", 4000/veloc);
}
}

//
//This function Iled reads the input string and makes txt[i] string fonts
//
function GeneraMsg(mensaje) {
msg= mensaje.toUpperCase(); //Pasamos a mayusculas
longMsg= msg.length
for(i=1;i<=longMsg;i++) {
simbolo= msg.substring(i-1,i)
if(simbolo=="A"){
txt[1] += "001000";
txt[2] += "010100";
txt[3] += "100010";
txt[4] += "111110";
txt[5] += "100010";
}
if(simbolo=="B"){
txt[1] += "111000";
txt[2] += "100100";
txt[3] += "111100";
txt[4] += "100010";
txt[5] += "111100";
}
if(simbolo=="C"){
txt[1] += "011100";
txt[2] += "100010";
txt[3] += "100000";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="D"){
txt[1] += "111100";
txt[2] += "100010";
txt[3] += "100010";
txt[4] += "100010";
txt[5] += "111100";
}
if(simbolo=="E"){
txt[1] += "11110";
txt[2] += "10000";
txt[3] += "11110";
txt[4] += "10000";
txt[5] += "11110";
}
if(simbolo=="F"){
txt[1] += "11110";
txt[2] += "10000";
txt[3] += "11100";
txt[4] += "10000";
txt[5] += "10000";
}
if(simbolo=="G"){
txt[1] += "011100";
txt[2] += "100000";
txt[3] += "101110";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="H"){
txt[1] += "100010";
txt[2] += "100010";
txt[3] += "111110";
txt[4] += "100010";
txt[5] += "100010";
}
if(simbolo=="I"){
txt[1] += "010";
txt[2] += "010";
txt[3] += "010";
txt[4] += "010";
txt[5] += "010";
}
if(simbolo=="J"){
txt[1] += "00010";
txt[2] += "00010";
txt[3] += "00010";
txt[4] += "10010";
txt[5] += "01100";
}
if(simbolo=="K"){
txt[1] += "10010";
txt[2] += "10100";
txt[3] += "11000";
txt[4] += "10100";
txt[5] += "10010";
}
if(simbolo=="L"){
txt[1] += "10000";
txt[2] += "10000";
txt[3] += "10000";
txt[4] += "10010";
txt[5] += "11110";
}
if(simbolo=="M"){
txt[1] += "100010";
txt[2] += "110110";
txt[3] += "101010";
txt[4] += "101010";
txt[5] += "100010";
}
if(simbolo=="N"){
txt[1] += "100010";
txt[2] += "110010";
txt[3] += "101010";
txt[4] += "100110";
txt[5] += "100010";
}
if(simbolo=="O"){
txt[1] += "011100";
txt[2] += "100010";
txt[3] += "100010";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="P"){
txt[1] += "11100";
txt[2] += "10010";
txt[3] += "11100";
txt[4] += "10000";
txt[5] += "10000";
}
if(simbolo=="Q"){
txt[1] += "0111000";
txt[2] += "1000100";
txt[3] += "1000100";
txt[4] += "1111100";
txt[5] += "0111010";
}
if(simbolo=="R"){
txt[1] += "111000";
txt[2] += "100100";
txt[3] += "111000";
txt[4] += "100100";
txt[5] += "100100";
}
if(simbolo=="S"){
txt[1] += "01100";
txt[2] += "10000";
txt[3] += "01100";
txt[4] += "00010";
txt[5] += "11100";
}
if(simbolo=="T"){
txt[1] += "111110";
txt[2] += "001000";
txt[3] += "001000";
txt[4] += "001000";
txt[5] += "001000";
}
if(simbolo=="U"){
txt[1] += "100010";
txt[2] += "100010";
txt[3] += "100010";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="V"){
txt[1] += "100010";
txt[2] += "100010";
txt[3] += "100010";
txt[4] += "010100";
txt[5] += "001000";
}
if(simbolo=="W"){
txt[1] += "100010";
txt[2] += "100010";
txt[3] += "101010";
txt[4] += "101010";
txt[5] += "010100";
}
if(simbolo=="X"){
txt[1] += "100010";
txt[2] += "010100";
txt[3] += "001000";
txt[4] += "010100";
txt[5] += "100010";
}
if(simbolo=="Y"){
txt[1] += "100010";
txt[2] += "010100";
txt[3] += "001000";
txt[4] += "001000";
txt[5] += "001000";
}
if(simbolo=="Z"){
txt[1] += "111110";
txt[2] += "000100";
txt[3] += "001000";
txt[4] += "010000";
txt[5] += "111110";
}
if(simbolo==" "){
txt[1] += "000000";
txt[2] += "000000";
txt[3] += "000000";
txt[4] += "000000";
txt[5] += "000000";
}
if(simbolo=="!"){
txt[1] += "010";
txt[2] += "010";
txt[3] += "010";
txt[4] += "000";
txt[5] += "010";
}
if(simbolo=='\"'){
txt[1] += "01010";
txt[2] += "01010";
txt[3] += "00000";
txt[4] += "00000";
txt[5] += "00000";
}
if(simbolo=="#"){
txt[1] += "010100";
txt[2] += "111110";
txt[3] += "010100";
txt[4] += "111110";
txt[5] += "010100";
}
if(simbolo=="$"){
txt[1] += "011100";
txt[2] += "101010";
txt[3] += "011100";
txt[4] += "001010";
txt[5] += "111100";
}
if(simbolo=="%"){
txt[1] += "110010";
txt[2] += "110100";
txt[3] += "001000";
txt[4] += "010110";
txt[5] += "100110";
}
if(simbolo=="&"){
txt[1] += "010000";
txt[2] += "101000";
txt[3] += "011010";
txt[4] += "100100";
txt[5] += "011010";
}
if(simbolo=="'"){
txt[1] += "10";
txt[2] += "10";
txt[3] += "00";
txt[4] += "00";
txt[5] += "00";
}
if(simbolo=="`"){
txt[1] += "10";
txt[2] += "10";
txt[3] += "00";
txt[4] += "00";
txt[5] += "00";
}
if(simbolo==":"){
txt[1] += "000";
txt[2] += "010";
txt[3] += "000";
txt[4] += "010";
txt[5] += "000";
}
if(simbolo==";"){
txt[1] += "000";
txt[2] += "010";
txt[3] += "000";
txt[4] += "010";
txt[5] += "100";
}
if(simbolo=="("){
txt[1] += "010";
txt[2] += "100";
txt[3] += "100";
txt[4] += "100";
txt[5] += "010";
}
if(simbolo==")"){
txt[1] += "100";
txt[2] += "010";
txt[3] += "010";
txt[4] += "010";
txt[5] += "100";
}
if(simbolo=="{"){
txt[1] += "0010";
txt[2] += "0100";
txt[3] += "1100";
txt[4] += "0100";
txt[5] += "0010";
}
if(simbolo=="}"){
txt[1] += "1000";
txt[2] += "0100";
txt[3] += "0110";
txt[4] += "0100";
txt[5] += "1000";
}
if(simbolo=="["){
txt[1] += "110";
txt[2] += "100";
txt[3] += "100";
txt[4] += "100";
txt[5] += "110";
}
if(simbolo=="]"){
txt[1] += "110";
txt[2] += "010";
txt[3] += "010";
txt[4] += "010";
txt[5] += "110";
}
if(simbolo=="@"){
txt[1] += "0111100";
txt[2] += "1111010";
txt[3] += "1101010";
txt[4] += "1110110";
txt[5] += "0111100";
}
if(simbolo=="+"){
txt[1] += "001000";
txt[2] += "001000";
txt[3] += "111110";
txt[4] += "001000";
txt[5] += "001000";
}
if(simbolo=="-"){
txt[1] += "000000";
txt[2] += "000000";
txt[3] += "111110";
txt[4] += "000000";
txt[5] += "000000";
}
if(simbolo=="*"){
txt[1] += "101010";
txt[2] += "011100";
txt[3] += "111110";
txt[4] += "011100";
txt[5] += "101010";
}
if(simbolo=="/"){
txt[1] += "000010";
txt[2] += "000100";
txt[3] += "001000";
txt[4] += "010000";
txt[5] += "100000";
}
if(simbolo=="="){
txt[1] += "000000";
txt[2] += "111110";
txt[3] += "000000";
txt[4] += "111110";
txt[5] += "000000";
}
if(simbolo=="^"){
txt[1] += "0100";
txt[2] += "1010";
txt[3] += "0000";
txt[4] += "0000";
txt[5] += "0000";
}
if(simbolo=="~"){
txt[1] += "10100";
txt[2] += "01010";
txt[3] += "00000";
txt[4] += "00000";
txt[5] += "00000";
}
if(simbolo=="|"){
txt[1] += "10";
txt[2] += "10";
txt[3] += "10";
txt[4] += "10";
txt[5] += "10";
}
if(simbolo=='\\'){
txt[1] += "100000";
txt[2] += "010000";
txt[3] += "001000";
txt[4] += "000100";
txt[5] += "000010";
}
if(simbolo=="_"){
txt[1] += "00000";
txt[2] += "00000";
txt[3] += "00000";
txt[4] += "00000";
txt[5] += "11110";
}
if(simbolo=="?"){
txt[1] += "01100";
txt[2] += "10010";
txt[3] += "00100";
txt[4] += "00000";
txt[5] += "00100";
}
if(simbolo=="."){
txt[1] += "00";
txt[2] += "00";
txt[3] += "00";
txt[4] += "00";
txt[5] += "10";
}
if(simbolo==","){
txt[1] += "000";
txt[2] += "000";
txt[3] += "000";
txt[4] += "010";
txt[5] += "100";
}
if(simbolo=="<"){
txt[1] += "00110";
txt[2] += "01000";
txt[3] += "10000";
txt[4] += "01000";
txt[5] += "00110";
}
if(simbolo=="\>"){
txt[1] += "11000";
txt[2] += "00100";
txt[3] += "00010";
txt[4] += "00100";
txt[5] += "11000";
}
if(simbolo=="1"){
txt[1] += "00100";
txt[2] += "01100";
txt[3] += "00100";
txt[4] += "00100";
txt[5] += "01110";
}
if(simbolo=="2"){
txt[1] += "011100";
txt[2] += "100010";
txt[3] += "001100";
txt[4] += "010000";
txt[5] += "111110";
}
if(simbolo=="3"){
txt[1] += "011100";
txt[2] += "100010";
txt[3] += "001100";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="4"){
txt[1] += "0011000";
txt[2] += "0101000";
txt[3] += "1111110";
txt[4] += "0001000";
txt[5] += "0001000";
}
if(simbolo=="5"){
txt[1] += "11110";
txt[2] += "10000";
txt[3] += "11100";
txt[4] += "00010";
txt[5] += "11100";
}
if(simbolo=="6"){
txt[1] += "01100";
txt[2] += "10000";
txt[3] += "11100";
txt[4] += "10010";
txt[5] += "01100";
}
if(simbolo=="7"){
txt[1] += "11110";
txt[2] += "10010";
txt[3] += "00100";
txt[4] += "00100";
txt[5] += "00100";
}
if(simbolo=="8"){
txt[1] += "011100";
txt[2] += "100010";
txt[3] += "011100";
txt[4] += "100010";
txt[5] += "011100";
}
if(simbolo=="9"){
txt[1] += "01100";
txt[2] += "10010";
txt[3] += "01110";
txt[4] += "00010";
txt[5] += "00010";
}
if(simbolo=="0"){
txt[1] += "01100";
txt[2] += "10010";
txt[3] += "10010";
txt[4] += "10010";
txt[5] += "01100";
}
}
ancho= txt[1].length; //anchura del simbolo en cuestion
}
// -->
</script>
</head>
<body bgcolor=white>
<script language="JavaScript1.1">
<!--
//Funciona con Netscape 3.x,IE 4.x o superiores.
navver=navigator.appVersion;
navver=navver.substring(0,1);
if(navver >= "3"){
message="Hola mundo! bienvenidos a mi pagina web ";
GeneraMsg(message);
Panel();
} else {
alert ("Su navegador es muy antiguo.\nActualicese caray!");
}
// -->
</script>
<center> <h1>Luminoso: vs.0.1 </h1>
Version adaptada, mejorada y ampliada<br>
del script JSLed, de M.Ishii<BR>
http://130.54.49.90/cgi-bin/kubotaE.html</center>
</body>
</html>

Luminoso javascript Categoría: Javascript, Efectos imagenes

Compartir Luminoso javascript en Facebook Twitter MySpace del.icio.us fresqui Meneame


Scripts Similares:

» Precarga de Imagenes con javascript
» Mover imagen javascript
» script cambiar imagen
» bloquear boton derecho del mouse con javascript
» Mover imagen javascript
» imagen texto agrupados script

Privacidad ּ Publicidad ּ Prensa ּ Premios ּ Colaborar ּ Enlazarnos ּ Mapa del Sitio ּ Aviso legal ּ Boletín ּ Contacto
2001 - 2010 - Sitio creado y mantenido por Gabriel Marcelo Rodriguez
Hosting de alta calidad a bajo costo | WAVENET.com