Giter Club home page Giter Club logo

canvacard's Introduction

Typing SVG

Potente herramienta de manipulación de imágenes para manipular imágenes fácilmente.

Discord

Typing SVG

npm i canvacard

Typing SVG

For CommonJS

const canvacard = require("canvacard");

For EsModule And TypeScript

import canvacard from "canvacard";

Features

  • Súper simple y fácil de usar 😎
  • Más rápido que canvacard v4 🚀
  • Todas las fuentes de Google Fonts 📚
  • ¿Más de 50 métodos ...? ¡Hurra! 🎉
  • Construido sobre un lienzo de nodos y sin tonterías involucradas 🔥
  • Orientado a objetos 💻
  • Apto para principiantes 🤓
  • Soporta emojis 😀

Ejemplos

Rank Card

const canvacard = require("canvacard");
const img = "https://cdn.discordapp.com/embed/avatars/0.png";
const background = "https://i.imgur.com/5O7xmVe.png";

const userData = getDataSomehow();

const rank = new canvacard.Rank()
  .setAvatar(img)
  .setBackground('IMAGE', background)
  .setCurrentXP(userData.xp)
  .setRequiredXP(userData.requiredXP)
  .setRank(userData.rank)
  .setRankColor("#FFFFFF")
  .setLevel(userData.level)
  .setLevelColor("#FFFFFF")
  .setStatus("online", true)
  .setCustomStatusColor("#23272A")
  .setOverlay("#23272A", 1 || 0, true)
  .setProgressBar(["#FF0000", "#0000FF"], "GRADIENT")
  .setProgressBarTrack("#000000")
  .setUsername("SrGobi")
  .renderEmojis(true)

rank.build()
  .then(data => {
    const attachment = new Discord.MessageAttachment(data, "RankCard.png");
    message.channel.send(attachment);
  });
PREVIEW

Welcomer Card

const canvacard = require("canvacard");
const img = "https://cdn.discordapp.com/embed/avatars/0.png";
const background = "https://i.imgur.com/5O7xmVe.png";

const welcomer = new canvacard.Welcomer()
  .setAvatar(img)
  .setBackground('IMAGE', background)
  .setTitulo("WELCOME")
  .setSubtitulo("Subtitulo personalizable!")
  .setTitulo("Titulo personalizable!")
  .setSubtitulo("Subtitulo personalizable!")
  .setColorTitulo("#FFFFFF");
  .setColorSubtitulo("#5865f2");
  .setColorCircle("#FFFFFF");
  .setColorOverlay("#000000");
  .setOpacityOverlay("0.4");

welcomer.build()
  .then(data => {
    const attachment = new Discord.MessageAttachment(data, "WelcomerCard.png");
    message.channel.send(attachment);
  });
PREVIEW

Otros ejemplos

const Discord = require('discord.js');
const client = new Discord.Client();
const canvacard = require('canvacard');

client.on('ready', () => {
	console.log('¡Estoy en línea!');
});

client.on('messageCreate', async (message) => {
	if (message.author.bot) return;
	if (message.content === '!triggered') {
		let avatar = message.author.displayAvatarURL({ dynamic: false, format: 'png' });
		let image = await canvacard.Canvas.trigger(avatar);
		let attachment = new Discord.MessageAttachment(image, 'triggered.gif');
		return message.channel.send(attachment);
	}
});

client.login('Tu_Bot_Token_aqui');
PREVIEW

Nota

⚠ | Para usar Canvacard#CaptchaGen, es posible que deba instalar paquetes como captcha-canvas.

canvacard's People

Contributors

comicallybad avatar srgobi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

canvacard's Issues

Suggestion of fixing progress bar to show specific progress from one rank to the next (explained further)

I wouldn't say this is much of an issue, rather a suggestion:

The progress bar, at high XP amounts always shows 90-100% complete.

If I had to suggest why this issue exists, and how to possibly fix it; I think the math to calculate how far the progress bar should go, needs to be updated/fixed. (I'll provide possible fixes)

EX: When you have 203K XP / 208K XP for your next level up, I can see why the progress bar would calculate that to show almost 100% complete.
208K-203K is only 5K XP away. If you're saying the whole progress bar is worth 208K XP, then 5K would be a small percentage.. (around 2.4% remaining).

How could this be fixed? Instead of calculating the progress bar by only going off of: current XP, and next level XP required, it should go off of: pervious level XP required, current XP, and next level XP required.

The reason I recommend this; even at very low XP requirements, take for example the images supplied on the ReadME.md...
Say level 2 level up requires that 300 XP, and level 3 level up requires 500 XP... The progress bar after leveling up to level 2 would already show you are already 3/5 of the way completed... As you are 300/500 XP required.

If canvacard took previous level XP, current XP, and next level XP, the user could see their specific progress from their current rank to next rank.
Another EX: rank 2 = 300 XP, rank 3 = 500 XP, they are at 0/200 XP required for the level up.
This could be done by setting progress bar maximum as: nextLevelXP- previousLevelXP.
As for showing this progression, simply use: currentXP - previousLevelXP.

With the above situation: instead of hitting rank 2 to see 3/5 progress already completed, it would now show 0/200 progress completed. (For most scenarios, the goal is to see progression of differences in levels.. So XP from the previous level, to the next level).

TLDR; The progress bar is basically a never ending, never "resetting" to 0% progress bar. It will always show you are part way/most of the way completed to next rank. Especially when the XP is in the thousands or hundreds of thousands.

Using nextLevelXP - previousLevelXP as the "XP goal/XP required" and currentXP - previousLevelXP as the progression towards level up, canvacard would fit the use case much better of actually showing your progression within a rank. With this said however, I would still like to have it show 203K / 208K as the XP above the bar, as this is correct, the progression bar alone is not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.