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 🙏

© 2025 – Pkg Stats / Ryan Hefner

string-scrambler-js

v1.0.14

Published

A flexible JavaScript library for dynamic string scrambling animations.

Readme

StringScrambler (SS)

StringScrambler é uma biblioteca JavaScript leve e flexível para criar transições dinâmicas entre strings com efeitos de scrambling. Ideal para animações em interfaces de usuário, efeitos visuais de texto e muito mais.

✨ Funcionalidades

  • Transições Dinâmicas: Interpole entre duas strings com efeitos suaves.
  • Modos de Animação:
    • random: Caracteres aleatórios durante a transição.
    • sequential: Alterações progressivas, caractere por caractere.
    • wave: Efeito de onda durante o scrambling.
  • Configurações Customizáveis:
    • Duração da animação.
    • Tipos de easing (linear, ease-in, ease-out).
    • Conjunto de caracteres embaralháveis definidos pelo usuário.
  • Loop e Reverso: Execute animações contínuas ou reverter automaticamente.

📦 Instalação

Via npm:

npm install string-scrambler-js

Ou, inclua diretamente no HTML:

<script src="https://cdn.jsdelivr.net/npm/string-scrambler-js/dist/StringScrambler.min.js"></script>

🚀 Como Usar

Usando JavaScript Puro

import StringScrambler from 'string-scrambler-js';

const scrambler = new StringScrambler();

scrambler.scramble({
  start: 'HELLO',
  end: 'WORLD',
  duration: 2000,
  mode: 'wave',
  onUpdate: (value) => console.log(value), // Atualiza a cada frame
  onComplete: () => console.log('Animação completa!'),
});

Usando com React

import React, { useEffect, useState } from 'react';
import StringScrambler from 'string-scrambler';

const ScrambleText = () => {
  const [text, setText] = useState('');

  useEffect(() => {
    const scrambler = new StringScrambler();
    scrambler.scramble({
      start: 'Welcome',
      end: 'React Rocks!',
      duration: 3000,
      mode: 'sequential',
      onUpdate: setText,
    });

    return () => scrambler.stop(); // Limpa a animação ao desmontar o componente
  }, []);

  return <h1>{text}</h1>;
};

export default ScrambleText;

⚙️ Configurações Disponíveis

| Opção | Tipo | Padrão | Descrição | |---------------|-------------|-------------------|---------------------------------------------------------------| | start | string | '' | String inicial da transição. | | end | string | '' | String final da transição. | | duration | number | 1000 | Duração da animação em milissegundos. | | onUpdate | function | undefined | Callback chamado em cada frame para atualizar a string. | | onComplete | function | undefined | Callback chamado ao final da animação. | | mode | string | 'random' | Modo de animação: random, sequential ou wave. | | characters | string | 'A-Za-z0-9' | Conjunto de caracteres embaralháveis. | | loop | boolean | false | Define se a animação deve ser contínua. | | ease | string | 'linear' | Tipo de easing: linear, ease-in, ease-out. |

🛠️ Desenvolvimento

Clone o repositório:

git clone https://github.com/gnai-creator/StringScrambler
cd StringScrambler
npm install

Rodar os Testes

npm test

Lint e Formatação

npm run lint
npm run format

📝 Contribuição

  1. Faça um fork do repositório.
  2. Crie uma branch para sua funcionalidade: git checkout -b minha-funcionalidade.
  3. Commit suas mudanças: git commit -m 'Adiciona minha funcionalidade'.
  4. Envie sua branch: git push origin minha-funcionalidade.
  5. Abra um Pull Request.

📄 Licença

Este projeto está licenciado sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.

🎉 Agradecimentos

Obrigado por usar o StringScrambler! Se tiver dúvidas ou sugestões, sinta-se à vontade para contribuir ou abrir uma issue.