Skip to content

Commit

Permalink
halve max frame time
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Sep 18, 2024
1 parent 9bb00ce commit 3024fe5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"prettier": "prettier \"{,!(node_modules)/**/}*.ts\" --config .prettierrc --write"
},
"devDependencies": {
"@types/node": "^22.5.4",
"nodemon": "^3.1.4",
"@types/node": "^22.5.5",
"nodemon": "^3.1.5",
"prettier": "^3.3.3"
},
"dependencies": {
Expand Down
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/helpers/images/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { AttachmentBuilder } from "discord.js";
import { ImageSource } from "@images/getImage";
import { MCMETA } from "@interfaces/database";

// same length as magma
export const MAX_FRAMETIME = 8;

/**
* Animate a given image with a given mcmeta
* @author Superboxer4, Evorp, Juknum
Expand All @@ -19,8 +22,8 @@ export async function animate(origin: ImageSource, mcmeta: MCMETA): Promise<Buff
mcmeta.animation.height ||= tileSheet.width;
mcmeta.animation.width ||= tileSheet.width;

// cap frametime at 15 (prismarine crashes otherwise)
const frametime = Math.min(15, mcmeta.animation.frametime || 1);
// cap frametime (prismarine crashes otherwise)
const frametime = Math.min(MAX_FRAMETIME, mcmeta.animation.frametime || 1);

const frames: { index: number; duration: number }[] = [];
if (mcmeta.animation.frames?.length) {
Expand Down

0 comments on commit 3024fe5

Please sign in to comment.