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

easy-frame

v1.1.1

Published

Zero-JS sprite sheet animation generator

Readme

EasyFrame

EasyFrame

Lightweight · Zero-config · Zero-JS usage · Just drop and animate


EasyFrame

Zero-JavaScript Sprite Sheet Animation Generator Lightweight, automatic, plug-and-play.

EasyFrame is a minimal runtime JavaScript library that automatically generates CSS sprite sheet animations directly from HTML data attributes.

No manual CSS writing.
No manual JavaScript initialization.
Just add a class and configuration — and it works.

Official Website


✨ Features

  • Zero configuration required
  • No manual JavaScript initialization
  • Automatic CSS & @keyframes generation
  • Supports segmented animations
  • Supports loop / ping-pong / single play
  • Optional pixelated rendering
  • Responsive container with data-ef-box (contain/cover modes)
  • Works via CDN, local file, or npm
  • UMD + ESM build

🚀 Installation

CDN (Recommended)

<script src="https://cdn.jsdelivr.net/gh/ShuninYu/[email protected]/dist/easy-frame.umd.min.js"></script>

or

<script src="https://cdn.jsdelivr.net/npm/easy-frame/dist/easy-frame.umd.min.js"></script>

NPM

npm install easyframe

ES Module:

import EasyFrame from "easyframe";

CommonJS:

const EasyFrame = require("easyframe");

⚡ Quick Start

<script src="easyframe.min.js"></script>

<div
  class="ef-sprite"
  data-ef="size:64x64;frames:6;duration:1"
  data-ef-src="/images/character.png">
</div>

That’s it. EasyFrame automatically creates a child element inside .ef-sprite to host the animation. The parent element’s size defaults to the size value (in pixels).


🧩 Configuration

All animation settings are defined inside the data-ef attribute.

Format:

data-ef="key:value;key:value;flag"

Required Parameters

| Key | Description | Example | | -------- | ------------------------------------------------------ | -------------------------------------- | | size | Frame size (width x height) – used for aspect ratio | size:64x64 | | frames | Number or segments | frames:6 or frames:4,3,7 | | duration | Duration in seconds | duration:1 or duration:0.4,0.2,0.6 |


Optional Parameters

| Key | Description | Example | | ----- | --------------------------- | ----------- | | mode | Animation mode | mode:loop | | pixel | Enables pixelated rendering | pixel |


🔁 Animation Modes

| Mode | Behavior | | -------- | ----------------------- | | loop | Infinite loop (default) | | pingpong | Infinite alternate | | none | Play once |

Example:

data-ef="size:64x64;frames:4;duration:1;mode:pingpong"

📦 Container Sizing and Fit

Use data-ef-box to control the dimensions of the parent container and how the sprite fills it.

Format:

data-ef-box="<width> <height> [fit]"
  • width / height: any valid CSS length (e.g., 50vw, 300px, 100%). Plain numbers are automatically treated as pixels.
  • fit (optional, default none):
    • none – Child element keeps the original frame size (from size) and sits at the top-left corner.
    • contain – Sprite scales to fit entirely inside the parent (letterboxing).
    • cover – Sprite scales to cover the parent (may be cropped).

Examples:

<!-- Parent size 50vw x 300px, cover mode -->
<div class="ef-sprite"
     data-ef="size:100x200;frames:8;duration:1"
     data-ef-src="sprite.png"
     data-ef-box="50vw 300px cover">
</div>

<!-- Parent size 200px x 150px, contain mode -->
<div class="ef-sprite"
     data-ef="size:64x64;frames:6;duration:1"
     data-ef-src="walk.png"
     data-ef-box="200px 150px contain">
</div>

<!-- Parent size defaults to frame size (64x64 px), fit=none -->
<div class="ef-sprite"
     data-ef="size:64x64;frames:6;duration:1"
     data-ef-src="walk.png">
</div>

If data-ef-box is omitted, the parent container’s dimensions are taken from the size value (in pixels), and fit is none. This ensures backward compatibility with previous versions.

Note: The sprite’s aspect ratio is always preserved according to the size in data-ef.


🎞 Segmented Animation Example

<div
  class="ef-sprite"
  data-ef="size:64x64;frames:4,3,7;duration:0.4,0.2,0.6;mode:pingpong;pixel"
  data-ef-src="/sprite/man.png">
</div>

This creates:

  • 3 animation segments
  • Custom duration per segment
  • Ping-pong looping
  • Pixelated rendering

🖼 Background Image

Set sprite image using:

data-ef-src="/path/to/sprite.png"

If omitted, background image must be defined in CSS.


🎨 Styling the Child Element

EasyFrame automatically adds a fixed class name ef-child to every generated child element that holds the animation. This allows you to target and style the animated element reliably, regardless of the dynamic UID suffix.

Global styling

To apply styles to all EasyFrame animations, simply use the .ef-child selector:

.ef-child {
  filter: drop-shadow(0 0 4px gold);
  border-radius: 8px;
}

Per‑instance styling

If you need to style only a specific animation, add your own class to the parent .ef-sprite element, then use a descendant selector:

<div class="ef-sprite my-walk-cycle" data-ef="size:64x64;frames:8;duration:1" data-ef-src="walk.png"></div>

<style>
  .my-walk-cycle .ef-child {
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
    transform: scale(1.1);
  }
</style>

Important: Do not rely on the dynamically generated class names like ef_child_2 – they change when the page structure is modified. Always use the fixed .ef-child class or a parent‑based selector.


🔄 Manual Refresh

If elements are added dynamically:

EasyFrame.refresh();   // Clears old child elements and regenerates styles

📦 API

| Method | Description | | --------------------- | ------------------------------ | | EasyFrame.init() | Manually initialize | | EasyFrame.refresh() | Re-scan DOM (clean & rebuild) | | EasyFrame.version | Library version |


🌍 Browser Support

Works in all modern browsers that support:

  • querySelectorAll
  • classList
  • dataset
  • CSS animations
  • aspect-ratio (modern browsers; fallback included for none)

No dependencies required.


📏 Bundle Size

  • ~3KB minified
  • No external dependencies

🛠 Design Philosophy

EasyFrame focuses on:

  • Simplicity
  • Minimal runtime cost
  • Zero boilerplate
  • Clean HTML-driven configuration

Advanced features (multi-row sprites, viewport detection, etc.) may be added in future versions, but the core will remain lightweight.


📄 License

MIT License
© 2026 ShuninYu