Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[K]Matrix - HTML + JS


Ultimate-Games

Rekomendowane odpowiedzi

Opublikowano

Pokaż kod.

 

<body bgcolor="#000">
<script type="text/javascript">
var height=35;
var speed=200;
var reveal=33;
var repeat=20;
var font=10;
var weird, table, columns, ma_txt;
reveal/=100;
var m_coch=new Array();
var m_copo=new Array();
var m_fast=new Array();
var m_comp=0;

window.onload=function() { if (document.getElementById) {
  var matrix, tbody, tr, td, ts;
  matrix=document.getElementById("matrix");
  ma_txt=matrix.firstChild.nodeValue;
  ma_txt=" "+ma_txt+" ";
  columns=ma_txt.length;
  while (matrix.childNodes.length) matrix.removeChild(matrix.childNodes[0]);
  for (td=33; td<126; td++) weird+='MPCFORUMmpcforumKamilSala';
  for (td=161; td<255; td++) weird+='!@#$%^&*()<>,.';

  table=document.createElement("table");
  table.cellSpacing=0;
  ts=table.style;
  ts.marginLeft="0";
  ts.marginRight="0";
  ts.width="100%";
  ts.border="none";
  tbody=document.createElement("tbody");
  for (x=0; x<height; x++) {
    tr=document.createElement("tr");
    for (y=0; y<columns; y++) {
      td=document.createElement("td");
      ts=td.style;
      ts.width="20px";
      ts.height="100%";
      ts.font=font+"pt monospace";
      ts.textAlign="center";
      ts.padding="none";
      ts.backgroundColor="#000000";
      ts.color="#000000";
      ts.border="none";
      td.appendChild(document.createTextNode(String.fromCharCode(700)));
      tr.appendChild(td);
    }
    tbody.appendChild(tr);
  }
  table.appendChild(tbody);
  matrix.appendChild(table);
  reset();
}}

function reset() {
  var i;
  m_comp=0;
  for (i=0; i<columns; i++) {
    m_fast[i]=speed*(0.5+Math.random());
    m_copo[i]=0;
    table.rows[1+Math.floor(height/2)].cells[i].style.color="#000000";
    newtricks(i);
  }
}

function newtricks(c) {
  var i, mtmp;
  if (m_copo[c]) {
    if (m_copo[c]<height+1) table.rows[m_copo[c]-1].cells[c].style.color="#ccffcc";
    if (m_copo[c]>1 && m_copo[c]<height+2) {
      mtmp=table.rows[m_copo[c]-2].cells[c];
      mtmp.style.fontWeight="normal";
      mtmp.style.color="#33ff33";
    }
    if (m_copo[c]>2 && m_copo[c]<height+3) table.rows[m_copo[c]-3].cells[c].style.color="#00cc00";
    if (m_copo[c]>=height && m_copo[c]<2*height) table.rows[m_copo[c]-height].cells[c].style.color="#003300";
    if (m_copo[c]>=height+1 && m_copo[c]<=2*height) table.rows[m_copo[c]-height-1].cells[c].style.color="#000000";
    if (m_copo[c]==Math.floor(height/2)+1 && m_coch[c]==ma_txt.charAt(c)) {
      setTimeout("zoomer("+c+")", m_fast[c]);
      if (++m_comp==columns && repeat) setTimeout("reset()", repeat*1000);
    }
    else if (m_copo[c]++<2*height) setTimeout("newtricks("+c+")", m_fast[c]);
    else {
      m_copo[c]=0;
      setTimeout("newtricks("+c+")", m_fast[c]);
    }
  }
  else {
    if (Math.random()>0.9) {
      if (reveal>Math.random() && (m_comp+1)/columns>Math.random()) m_coch[c]=ma_txt.charAt(c);
      else m_coch[c]=weird.charAt(Math.floor(Math.random()*weird.length));
      for (i=0; i<height; i++) {
        table.rows[i].cells[c].firstChild.nodeValue=m_coch[c];
        table.rows[i].cells[c].style.fontWeight="bold";
      }
      m_copo[c]++;
      m_fast[c]=speed*(0.5+Math.random());
    }
    setTimeout("newtricks("+c+")", m_fast[c]);
  }
}

function zoomer(c) {
  var mtmp, mtem, ytmp;
  if (m_copo[c]==Math.floor(height/2)+1) {
    for (ytmp=0; ytmp<height; ytmp++) {
      mtmp=table.rows[ytmp].cells[c];
      mtmp.firstChild.nodeValue=m_coch[c];
      mtmp.style.color="#ccffcc";
      mtmp.style.fontWeight="bold";
      if (alink) {
        mtmp.style.cursor="pointer";
        mtmp.onclick=function() { window.location.href=alink };
      }
    }
    mtmp=ma_txt.indexOf(ma_txt.charAt(c));
    m_copo[c]+=199;
    setTimeout("zoomer("+c+")", speed);
  }
  else if (m_copo[c]>200) {
    mtmp=table.rows[m_copo[c]-201].cells[c];
    mtem=table.rows[200+height-m_copo[c]].cells[c];
    m_copo[c]-=1;
    mtmp.style.fontWeight="normal";
    mtmp.style.color="#33ff33";
    mtem.style.fontWeight="normal";
    mtem.style.color="#33ff33";
    setTimeout("zoomer("+c+")", speed);
  }
  else if (m_copo[c]==200) m_copo[c]=100+Math.floor(height/2);
  if (m_copo[c]>100 && m_copo[c]<200) {
    mtmp=table.rows[m_copo[c]-101].cells[c];
    mtmp.firstChild.nodeValue=String.fromCharCode(160);
    mtem=table.rows[100+height-m_copo[c]].cells[c];
    mtem.firstChild.nodeValue=String.fromCharCode(160);
    m_copo[c]-=1;
    setTimeout("zoomer("+c+")", speed);
  }
}
</script>
<div id="matrix">KamilSala</div>

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...