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

svelte-text-animation

v0.1.2

Published

A smooth character-by-character text animation component for Svelte

Readme

Text Animation Component

A smooth text animation component for Svelte applications that provides customizable character-by-character animations with optimized performance.

Example Animation

You can check out the Demo in a Svelte Playground!

Installation

npm install svelte-text-animation

Usage

<script>
import { TextAnimation, map } from 'svelte-text-animation';
import { Tween } from 'svelte/motion';

let progress = new Tween(0);

const animate = () => {
    progress.target = progress.current === 0 ? 1 : 0;
};
</script>

<TextAnimation
    text="Hello World"
    progress={progress.current}
    styleCallback={(i) => `font-weight: ${map(i, 200, 900)}`}
/>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | text | string | required | The text to be animated | | progress | number | required | Animation progress (0-1) | | styleCallback | function | required | Style generator function | | spread | number | 3 | Number of characters affected on each side | | edgeFlatness | number | 5 | Controls the flatness of the edge decay curve. Higher values make the curve flatter in the middle, keeping the effect intensity closer to 1 for a larger range. Must be an integer >= 2. | | innerClassName | string | "" | CSS class for character spans |

Examples

Basic Font Weight Animation

<TextAnimation
    text="Dynamic Weight"
    progress={progress}
    styleCallback={(i) => `font-weight: ${map(i, 200, 900)}`}
/>

Color Animation

<TextAnimation
    text="Color Fade"
    progress={progress}
    styleCallback={(i) => `color: rgba(255, 0, 0, ${i})`}
/>

Advanced Variable Font Animation with Optimized Performance

<script>
import { Tween } from 'svelte/motion';
import { cubicInOut } from 'svelte/easing';
import TextAnimation, { map } from 'svelte-text-animation';

const progress = new Tween(0, { 
    duration: 3800, 
    easing: cubicInOut 
});

// Auto animation
progress.target = 1;
setInterval(() => (progress.target = progress.target == 0 ? 1 : 0), 4300);
</script>

<link href="https://fonts.googleapis.com/css2?family=Climate+Crisis:[email protected]&display=swap" rel="stylesheet" />

<TextAnimation
    text="Variable Font Magic"
    className="climate-crisis"
    progress={progress.current}
    spread={5}
    edgeFlatness={5}
    styleCallback={(intensity) => `
        font-size: ${map(intensity, 5, 4)}rem;
        font-variation-settings: "YEAR" ${map(intensity, 1979, 2040)};
    `}
/>

<style>
    :global(.climate-crisis) {
        font-family: 'Climate Crisis', sans-serif;
        font-optical-sizing: auto;
        font-weight: 400;
        font-style: normal;
    }
</style>

Features

  • Optimized performance with edge decay function for smooth animations
  • Configurable curve flatness for customizable animation profiles
  • Efficient effect calculation with intensity thresholds
  • Built-in map utility function for value interpolation
  • Automatic handling of non-space characters for better display
  • Svelte 5.0.0 compatible

Requirements

  • Svelte 5.0.0 or higher

License

MIT