Skip to content

Instantly share code, notes, and snippets.

@0xdeployer
0xdeployer / frameIndex.ts
Last active February 9, 2024 05:00
Nethria Text Based Mini Game Frame
import { Request, Response } from "express";
import { createCanvas } from "canvas";
import GifEncoder from "gifencoder";
export async function generateImage(label: string): Promise<Buffer> {
const width = 955;
const height = 500;
const canvas = createCanvas(width, height);
const ctx = canvas.getContext("2d");
@0xdeployer
0xdeployer / render-pixelglyph.ts
Created July 26, 2021 23:00
Function used to render Pixelglyphs using HTML Canvas
/**
The following function is used to re-create Pixelglyphs from on-chain data.
Original glyphs were created with the following:
const matrix = [ [ 0, 0, 0, 0, 0 ], [ 0, 1, 1, 0, 1 ], [ 0, 1, 1, 0, 0 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 1, 1, 1, 1 ], [ 0, 1, 0, 0, 0 ], [ 0, 1, 1, 1, 1 ], [ 0, 1, 1, 1, 1 ], [ 0, 0, 0, 0, 0 ] ];
const colors = [ "rgb(93,19,36)", "rgb(123,234,113)", "rgb(173,109,23)" ];
render(canvasElement, matrix, 37, ...colors);
*/