Ord.io Logo
Ord.io
Inscription

63,386,849

<html>
<meta charset="UTF-8">
<title>#666,883_remix_by_rax</title>
<style>
  body {
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #000 url('/content/2f5cebc840f00c4a729c0e0df579441fdd0381859b4843a8a9a1909a77d147dei0') no-repeat center top / 100% 100%;
    color: #9E0303f;
    font-family: monospace;
    font-size: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
  }

  #screen,
  pre {
    white-space: pre;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin-top: 0;
  }
</style>

<body>
  <pre id="screen"></pre>
  <script>
    function shuffleArray(array) {
      let currentIndex = array.length,
        randomIndex;
      while (currentIndex !== 0) {
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex--;
        [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
      }
      return array;
    }
    var ClassicalNoise = function(r) {
      this.grad3 = [
        [1, 1, 0],
        [-1, 1, 0],
        [1, -1, 0],
        [-1, -1, 0],
        [1, 0, 1],
        [-1, 0, 1],
        [1, 0, -1],
        [-1, 0, -1],
        [0, 1, 1],
        [0, -1, 1],
        [0, 1, -1],
        [0, -1, -1]
      ];
      this.p = [];
      for (var i = 0; i < 256; i++) {
        this.p[i] = Math.floor(r() * 256);
      }
      this.perm = [];
      for (var i = 0; i < 512; i++) {
        this.perm[i] = this.p[i & 255];
      }
    };
    ClassicalNoise.prototype.dot = function(g, x, y, z) {
      return g[0] * x + g[1] * y + g[2] * z;
    };
    ClassicalNoise.prototype.mix = function(a, b, t) {
      return (1.0 - t) * a + t * b;
    };
    ClassicalNoise.prototype.fade = function(t) {
      return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
    };
    ClassicalNoise.prototype.noise = function(x, y, z) {
      var X = Math.floor(x),
        Y = Math.floor(y),
        Z = Math.floor(z);
      x = x - X;
      y = y - Y;
      z = z - Z;
      X = X & 255;
      Y = Y & 255;
      Z = Z & 255;
      var gi000 = this.perm[X + this.perm[Y + this.perm[Z]]] % 12;
      var gi001 = this.perm[X + this.perm[Y + this.perm[Z + 1]]] % 12;
      var gi010 = this.perm[X + this.perm[Y + 1 + this.perm[Z]]] % 12;
      var gi011 = this.perm[X + this.perm[Y + 1 + this.perm[Z + 1]]] % 12;
      var gi100 = this.perm[X + 1 + this.perm[Y + this.perm[Z]]] % 12;
      var gi101 = this.perm[X + 1 + this.perm[Y + this.perm[Z + 1]]] % 12;
      var gi110 = this.perm[X + 1 + this.perm[Y + 1 + this.perm[Z]]] % 12;
      var gi111 = this.perm[X + 1 + this.perm[Y + 1 + this.perm[Z + 1]]] % 12;
      var n000 = this.dot(this.grad3[gi000], x, y, z);
      var n100 = this.dot(this.grad3[gi100], x - 1, y, z);
      var n010 = this.dot(this.grad3[gi010], x, y - 1, z);
      var n110 = this.dot(this.grad3[gi110], x - 1, y - 1, z);
      var n001 = this.dot(this.grad3[gi001], x, y, z - 1);
      var n101 = this.dot(this.grad3[gi101], x - 1, y, z - 1);
      var n011 = this.dot(this.grad3[gi011], x, y - 1, z - 1);
      var n111 = this.dot(this.grad3[gi111], x - 1, y - 1, z - 1);
      var u = this.fade(x);
      var v = this.fade(y);
      var w = this.fade(z);
      var nx00 = this.mix(n000, n100, u);
      var nx01 = this.mix(n001, n101, u);
      var nx10 = this.mix(n010, n110, u);
      var nx11 = this.mix(n011, n111, u);
      var nxy0 = this.mix(nx00, nx10, v);
      var nxy1 = this.mix(nx01, nx11, v);
      var nxyz = this.mix(nxy0, nxy1, w);
      return nxyz;
    };
    const mod = 2 ** 31 - 1;
    const a = 1103515245;
    const c = 12345;
    let seed;
    let lastBlockHeight = null;

    function random() {
      seed = (a * seed + c) % mod;
      return seed / mod;
    }

    function hashCode(str) {
      let hash = 0;
      if (str.length === 0) return hash;
      for (let i = 0; i < str.length; i++) {
        const char = str.charCodeAt(i);
        hash = (hash << 5) - hash + char;
        hash = hash & hash;
      }
      return Math.abs(hash);
    }
    const charColors = ['black', '#880808', '#34495E', 'red', '#7a0606', 'grey', 'black'];
    async function getBlockHeight() {
      try {
        const response = await fetch('/blockheight');
        const blockHeight = await response.text() || 0;
        if (blockHeight !== lastBlockHeight) {
          seed = hashCode(blockHeight);
          shuffleArray(charColors);
          lastBlockHeight = blockHeight;
        }
      } catch (err) {
        console.error("Failed to fetch block height:", err);
      }
    }

    function init() {
      const screenEl = document.getElementById('screen');
      const asciiChars = ['⚔︎⚔︎⚔︎⚔︎', '✘', '🔥', '🩸', '️🪦', 'xx', '️💀', 'X', '️⛓', '|||'];
      let fontSize = 20;
      let charAspectRatio = 0.55;
      let screenW = Math.floor(window.innerWidth / (fontSize * charAspectRatio));
      let screenH = Math.floor(window.innerHeight / fontSize);
      let frame = 0;
      const noise = new ClassicalNoise(random);

      function getColorForChar(char) {
        const charIndex = asciiChars.indexOf(char);
        return charColors[charIndex % charColors.length];
      }
      let lastTime = performance.now();

      function loop(currentTime) {
        let deltaTime = (currentTime - lastTime) / 10;
        let fps = 1 / 30;
        if (deltaTime > fps) deltaTime = fps;
        let str = '';
        for (let y = 0; y < screenH; y++) {
          for (let x = 0; x < screenW; x++) {
            let n = noise.noise(x * 0.1, y * 0.1, frame * 0.01);
            let index = Math.floor((n + 1) * 0.5 * asciiChars.length);
            let char = asciiChars[Math.min(index, asciiChars.length - 1)];
            str += `<span style="color: ${getColorForChar(char)}">${char}</span>`;
          }
          str += '\n';
        }
        screenEl.innerHTML = str;
        frame += deltaTime * 30;
        lastTime = currentTime;
        setTimeout(() => {
          requestAnimationFrame(loop);
        }, 1000 / 25)
      }
      requestAnimationFrame(loop);
    }
    setInterval(getBlockHeight, 420690);
    getBlockHeight().then(init).catch(err => console.error("Failed to initialize:", err));
  </script>
</body>

</html>

Knox

1 year ago

Collab by RaxOnChain https://twitter.com/Raxonchain
Image

Rax

1 year ago

💀🖖
  • ID

    6b512...fbei0

  • Owned By
  • File Type

    HTMLtext/html;charset=utf-8

  • File Size

    6.409 KB

  • Created

    March 6, 2024, 1:24 AM UTC

    1 year ago

  • Creation Block
  • Creation Transaction
  • Creation Fee

    47,223sats

  • Tags

    No tags yet

Sat

Recursive Modules