npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

exo-pet-pet

v3.4.0

Published

Genera un GIF animado de una mascota acariciando un avatar con opciones avanzadas de personalización

Readme

exo-pet-pet

Genera un GIF animado de una mascota acariciando un avatar cuadrado con opciones avanzadas de personalización.

El avatar rebotará hacia arriba y abajo para simular las caricias, con control total sobre la intensidad, velocidad y más.

Instalación

npm install exo-pet-pet

Uso básico

const petPetGif = require('exo-pet-pet')

const generarGif = async () => {
    const gifAnimado = await petPetGif('https://ejemplo.com/avatar.png')
    return gifAnimado
}

Ejemplo con Discord.js

const { SlashCommandBuilder, AttachmentBuilder } = require('discord.js');
const petPetGif = require('exo-pet-pet');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('petpet')
        .setDescription('Crea un gif pet pet del avatar de un usuario')
        .addUserOption(option => 
            option.setName('usuario')
                .setDescription('Usuario a acariciar')
                .setRequired(true)),
    
    async execute(interaction) {
        await interaction.deferReply();

        const user = interaction.options.getUser('usuario');
        const avatarUrl = user.displayAvatarURL({ extension: 'png', size: 256 });

        const petGif = await petPetGif(avatarUrl);
        const attachment = new AttachmentBuilder(petGif, { name: 'petpet.gif' });

        await interaction.editReply({ files: [attachment] });
    },
};

Guardar el GIF en archivo

const petPetGif = require('exo-pet-pet')
const fs = require('fs')

const guardarGif = async (avatarURL) => {
    const gifAnimado = await petPetGif(avatarURL)
    
    fs.writeFile('resultado.gif', gifAnimado, (err) => {
        if (err) {
            console.log('Error al guardar el archivo')
        } else {
            console.log('GIF guardado exitosamente')
        }
    })
}

Opciones de configuración

const gifAnimado = await petPetGif('https://ejemplo.com/avatar.png', {
    resolution: 128,
    delay: 20,
    backgroundColor: 'red',
    frames: 10,
    squishFactor: 1.0,
    reverseAnimation: false
})

Parámetros disponibles

| Parámetro | Tipo | Por defecto | Descripción | |-----------|------|-------------|-------------| | resolution | Number | 128 | Ancho y alto del GIF en píxeles | | delay | Number | 20 | Retraso entre frames en milisegundos | | backgroundColor | String | null | Color de fondo (red, #ff0000, rgba(255,0,0,0.5), null = transparente) | | frames | Number | 10 | Número de frames (más = más suave) | | squishFactor | Number | 1.0 | Intensidad del aplastamiento (0.5 = suave, 2.0 = intenso) | | reverseAnimation | Boolean | false | Invertir dirección de la animación |

Ejemplos de uso

GIF de alta resolución

await petPetGif(avatarURL, { resolution: 256 })

GIF más lento y suave

await petPetGif(avatarURL, { delay: 30, frames: 15 })

Efecto intenso

await petPetGif(avatarURL, { squishFactor: 2.0 })

Efecto suave

await petPetGif(avatarURL, { squishFactor: 0.5 })

Animación invertida

await petPetGif(avatarURL, { reverseAnimation: true })

Con fondo personalizado

await petPetGif(avatarURL, { backgroundColor: 'rgba(0, 0, 0, 0.5)' })

Configuración completa

await petPetGif(avatarURL, {
    resolution: 200,
    delay: 15,
    backgroundColor: '#ffffff',
    frames: 12,
    squishFactor: 1.5,
    reverseAnimation: false
})

Funciones adicionales

Generar como Stream

const stream = await petPetGif.generateStream(avatarURL, options)

Generar como Base64

const base64 = await petPetGif.generateBase64(avatarURL, options)

Limpiar caché

petPetGif.clearCache()

Requisitos

  • Node.js >= 14.0.0
  • Las imágenes deben ser accesibles vía URL o Buffer

Características

  • Alta performance con @napi-rs/canvas
  • Generación eficiente con gif-encoder-2
  • Animación personalizable
  • Transparencia y fondos personalizados
  • Caché inteligente
  • Múltiples formatos de salida (Buffer, Stream, Base64)

Casos de uso

  • Bots de Discord, Telegram, Slack
  • Generadores de memes
  • Herramientas de redes sociales
  • Aplicaciones web interactivas

Licencia

ISC

Changelog

v3.1.0

  • Migración a gif-encoder-2 para mejor compatibilidad
  • Opción frames para controlar número de frames
  • Opción squishFactor para ajustar intensidad
  • Opción reverseAnimation para invertir animación
  • Función generateStream() para streams
  • Función generateBase64() para formato base64
  • Función clearCache() para gestión de memoria
  • Mejoras de rendimiento

v3.0.0

  • Versión inicial con @napi-rs/canvas
  • Soporte básico para generación de GIFs