Skip to content
Snippets Groups Projects
Select Git revision
  • 757293a903855ea1123976f395d6c87f48a13a83
  • main default protected
2 results

index.html

Blame
  • index.html 1.07 KiB
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Sprite checker</title>
    </head>
    <body>
    
        <p>using code generated with https://xem.github.io/miniPixelArt/</p>
    
        <canvas id=a>
        <script>
            ctx=a.getContext`2d` // ctx
            pallette="000f000f000fff00fff0f" // color palette (you can remove the colors you didn't use to save bytes)
            pixels=[];
            "IIIIIIQIQQQJZQZZRZRRZRZRSSRSRZZR".replace(/./g,
                character=>{
                    characterCode=character.charCodeAt(),
                        pixels.push(characterCode&7), // Gets the last three bits
                        pixels.push((characterCode>>3)&7) // Gets the first three bits
                }) // pixel decoding
            size=8;
            for (let y = 0; y < size; y++) {
                for (let x = 0; x < size; x++) {
                    if (pixels[y * size + x]) {
                        ctx.fillStyle = "#" + pallette.substr(3 * (pixels[y * size + x] - 1), 3),
                            ctx.fillRect(x, y, 1, 1)
                    }
                }
            } // drawing
        </script>
    </body>
    </html>