Options
All
  • Public
  • Public/Protected
  • All
Menu

ImageScript level card

ImageScript variable injection

ImageScript
textColor = parseInt(textColor, 16);
xpBarColor = parseInt(xpBarColor, 16);

const image = Image.new(512, 170);

avatar = Image.load(avatar).cropCircle();
if (avatar.width !== 128)
    avatar.resize(128, 128);

tag = Image.renderText(52, textColor, font, tag);

const g = (x, y) => Math.sin(x ^ y) / Math.cos(y ^ x) / seed;
image.fill((x, y) => Image.rgbToColor(g(x, x), g(y, y), g(x, y)));

const xpText = Image.renderText(38, textColor, font, `${xp}/${next} XP`);
const levelText = Image.renderText(115, textColor, font, `LEVEL ${level}`);

image.composite(avatar, 20, 20);
image.composite(tag, 30 + avatar.width, 5);
image.composite(levelText, 45 + avatar.width, tag.height - 15);
image.composite(xpText, image.width - 5 - xpText.width, image.height - 35);
image.drawBox(0, image.height - 3, Math.floor(xp * (image.width / next)), 3, xpBarColor);

Injected variables
{
  "xp": 75,
  "level": 5,
  "tag": "matmen#0911",
  "font": "BalooExtraBold",
  "textColor": "fafbfcff",
  "xpBarColor": "ffff00ff",
  "avatar": "https://cdn.discordapp.com/avatars/687945863053443190/43022bb80ae031830866caacc18312de.png?size=1024",
  "next": 475,
  "seed": 16
}

Explanation:
xp: the users current xp points
level: the users current xp level
tag: the users tag (Username#Discriminator) font: the font to use
textColor: the color to render the text in
xpBarColor: the color to render the xp bar in
avatar: the users avatar URL
next: the xp points the next level will be reached at
seed: the background seed to use (gives the best results between 5 and 35)