Untitled

 avatar
unknown
javascript
4 years ago
747 B
7
Indexable
let scnEffect = 0

function TIC() {
  scnEffect += 0.35
}

function SCN(scn: number) {
  // Loop through colors in ram
  for (let i = 0; i < 16; i++) {
    // Grayscale effect
    if (scn >= l - 1 && scn <= l + 1) {
      const [r, g, b] = [
        peek(0x3fc0 + i * 3 + 0),
        peek(0x3fc0 + i * 3 + 1),
        peek(0x3fc0 + i * 3 + 2),
      ]
      let linear = r * 0.2126 + g * 0.7152 + b * 0.0722
      poke(0x3fc0 + i * 3 + 0, linear)
      poke(0x3fc0 + i * 3 + 1, linear)
      poke(0x3fc0 + i * 3 + 2, linear)
    }

    // reset rgb values
    else {
      sync(32, 0, false)
      // poke(0x3fc0 + i * 3 + 0, colors[i][0])
      // poke(0x3fc0 + i * 3 + 1, colors[i][1])
      // poke(0x3fc0 + i * 3 + 2, colors[i][2])
    }
  }
}
Editor is loading...