This commit is contained in:
dwelle 2024-03-07 20:00:03 +01:00
parent b2a6a87b10
commit 0e02366dee
37 changed files with 1095 additions and 596 deletions

View file

@ -1,5 +1,6 @@
import { exportToCanvas } from "./scene/export";
import { getDefaultAppState } from "./appState";
import { COLOR_WHITE } from "./constants";
const { registerFont, createCanvas } = require("canvas");
@ -57,22 +58,21 @@ const elements = [
registerFont("./public/Virgil.woff2", { family: "Virgil" });
registerFont("./public/Cascadia.woff2", { family: "Cascadia" });
const canvas = exportToCanvas(
elements as any,
{
...getDefaultAppState(),
offsetTop: 0,
offsetLeft: 0,
width: 0,
height: 0,
const canvas = exportToCanvas({
data: {
elements: elements as any,
appState: {
...getDefaultAppState(),
width: 0,
height: 0,
},
files: {}, // files
},
{}, // files
{
exportBackground: true,
viewBackgroundColor: "#ffffff",
config: {
canvasBackgroundColor: COLOR_WHITE,
createCanvas,
},
createCanvas,
);
});
const fs = require("fs");
const out = fs.createWriteStream("test.png");