This commit is contained in:
Maciej Caderek
2022-01-24 04:35:35 +01:00
parent b7d53a045f
commit 0c2f804021
6 changed files with 82 additions and 43 deletions

View File

@@ -46,7 +46,7 @@ const play = async (board: Board, pgn: string | null, interval: number) => {
};
const createDownloadLink = async (pgn: string, style: Style) => {
const file = await createAnimation(pgn, style, 720, "WebM");
const file = await createAnimation(pgn, style, 720, "MP4");
const link = document.createElement("a");
link.innerText = "DOWNLOAD";
link.setAttribute("href", URL.createObjectURL(file));
@@ -57,7 +57,7 @@ const createDownloadLink = async (pgn: string, style: Style) => {
console.log(createDownloadLink.name);
const main = async () => {
const style = styles.lila;
const style = styles.calm;
// window.location.hash =
// "#QiBEdWtlIEthcmwgLyBDb3VudCBJc291YXJkCkQgMTg1OC4/Py4/PwpFIFBhcmlzClIgMS0wClMgUGFyaXMgRlJBClcgUGF1bCBNb3JwaHkKCmU0IGU1IE5mMyBkNiBkNCBCZzQgZHhlNSBCeGYzIFF4ZjMgZHhlNSBCYzQgTmY2IFFiMyBRZTcgTmMzIGM2IEJnNSBiNSBOeGI1IGN4YjUgQnhiNSsgTmJkNyBPLU8tTyBSZDggUnhkNyBSeGQ3IFJkMSBRZTYgQnhkNysgTnhkNyBRYjgrIE54YjggUmQ4Iw==";
@@ -65,17 +65,16 @@ const main = async () => {
// const hash = window.location.hash;
// const pgn = hash === "" ? null : decompressPGN(hash.slice(1));
const pgn = pgns[pgns.length - 12];
const board = new Board(8).setStyle(style).setSize(720).hideBorder();
const board = new Board(8).setStyle(style).setSize(720).showBorder();
$app?.appendChild(board.canvas);
const interval = 1000;
play(board, pgn, interval);
// createDownloadLink(pgns[2], style).then((link) => {
// document.body.appendChild(link);
// console.log("Animation created!");
// });
createDownloadLink(pgns[2], style).then((link) => {
document.body.appendChild(link);
});
};
WebFont.load({