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

@angelardanaz/air

v1.1.1

Published

Utilidad ligera para animaciones web: animacion declarativa con la Web Animations API, triggers de scroll, scroll suave y helpers (`stagger`, `split`, `tween`, `easings`).

Readme

air

Utilidad ligera para animaciones web: animacion declarativa con la Web Animations API, triggers de scroll, scroll suave y helpers (stagger, split, tween, easings).

Instalacion

npm install @angelardanaz/air

API

animate(targets, keyframes, options)

Animaciones con la Web Animations API, con normalizacion de keyframes y soporte integrado para scrollTrigger.

  • targets: Element o iterable de elementos (NodeList, array).
  • keyframes: array de fotogramas, objeto { from, to } o solo { to }. Si solo se declara el final, el inicio se rellena leyendo estilos computados (transform, translate/x/y, valores numericos).
  • options principales:
    • duration (ms, 600 por defecto) y delay.
    • easing: nombre abreviado (i1, o3, li, etc.), string CSS o cubic-bezier(...).
    • stagger: funcion (index, total) => delay. Usa stagger() de la libreria para obtenerla facilmente.
    • onComplete: callback al terminar cada animacion ([{ el, animation }]).
    • scrollTrigger: objeto de opciones de scrollTrigger para animacion manual ligada al scroll.
  • Devuelve { el, animation } (modo Web Animations) o { el, trigger } (modo scrollTrigger).

Ejemplo con solo to y stagger:

import { animate, stagger } from "@angelardanaz/air";

const cards = document.querySelectorAll(".card");

animate(cards, { to: { opacity: 1, y: 0 } }, {
  duration: 700,
  easing: "io2",
  delay: 150,
  stagger: stagger(80, { from: "center" }),
});

scrollTrigger(options)

Vincula el progreso de una animacion (o cualquier callback) al desplazamiento usando el scroll nativo del navegador o una instancia de scroll.

  • scroll: instancia de scroll o deja vacio para usar el scroll nativo del navegador.
  • trigger: elemento o funcion que lo devuelve.
  • start / end: numero (px), string tipo "top center" (elemento viewport) o funcion que recibe { el, vh, current, maxScroll, rect, top, bottom } y devuelve una posicion absoluta.
  • Callbacks: onEnter, onLeave, onUpdate({ progress, rawProgress, current, start, end, entered, el, direction, velocity }).
  • Flags: once (destruye tras el primer paso), scrub (true sin suavizado o numero en ms para amortiguar), markers (muestra lineas de inicio/fin) y pin (sticky mientras se esta dentro del rango).
  • Devuelve { recalc, destroy, state }.

Ejemplo ligando una animacion manual:

import { animate, scroll } from "@angelardanaz/air";

const scroller = new scroll();
const hero = document.querySelector(".hero");

animate(hero, { to: { y: -120, opacity: 0 } }, {
  easing: "io3",
  scrollTrigger: {
    scroll: scroller,
    start: "top top",
    end: "bottom center",
    scrub: 180,
  },
});

scroll (clase)

Motor de scroll suave con soporte para rueda, tactil y teclado. Respeta prefers-reduced-motion desactivando la inercia.

  • Opciones: container (por defecto [data-scroll-container] o documento), content (primer hijo por defecto), damping (0.1), wheelMultiplier / touchMultiplier (1), keyStep (80), easing (funcion), smoothToDuration (0), autoResize (true).
  • Estado expuesto: current, target, maxScroll, state.reduceMotion, velocity, direction.
  • onUpdate(fn): se llama en cada frame y devuelve una funcion para desuscribirse.
  • scrollTo(y, { immediate, duration, easing }): mueve a la posicion objetivo, respetando limites; devuelve una promesa que resuelve al finalizar.
  • enable(), disable(), destroy(): control del ciclo de vida.

tween(options)

Interpolacion generica sin tocar el DOM, basada en requestAnimationFrame.

  • from y to: numero, array o objeto; los campos ausentes se rellenan con cero.
  • duration (600), delay (0), easing (nombre abreviado o funcion), autoplay (true).
  • Callbacks: onStart, onUpdate({ value, progress, rawProgress }), onComplete.
  • Control: play(), pause(), resume(), cancel(), seek(p), isActive(), progress().

Ejemplo basico actualizando estilos sin Web Animations:

import { tween } from "@angelardanaz/air";

const box = document.querySelector(".box");

const control = tween({
  from: { x: 0, opacity: 0.4 },
  to: { x: 180, opacity: 1 },
  duration: 900,
  easing: "io3",
  onUpdate: ({ value }) => {
    box.style.transform = `translateX(${value.x}px)`;
    box.style.opacity = value.opacity;
  },
});

// control.pause(); control.resume(); control.seek(0.5); control.cancel();

stagger(each = 50, { from = "start" })

Genera una funcion para escalonar retardos: desde el inicio, el final o el centro. Ideal para pasarlo a options.stagger de animate.

split(el, mode = "letters")

Divide el texto de un elemento en spans para animarlos por separado. Modos: "letters", "words", "lines". Devuelve el array de spans generados y aplica clases split-wrapper + letter|word|line para estilizarlos.

Easings y helpers

  • EASINGS: mapa de nombres abreviados (li, i1..i6, o1..o6, io1..io6) a puntos de curva.
  • DEFAULT_EASING_NAME: li (lineal).
  • easingNameToFn(name|fn): devuelve una funcion de easing (o la misma si ya es funcion).
  • easingNameToTiming(name): devuelve string cubic-bezier(...) para usar en CSS.
  • cubicBezier(x1, y1, x2, y2): genera un easing personalizado.

Demo local

Hay un ejemplo rapido en demo/ (ignorado en git y fuera del paquete npm). Levanta un server estatico y abre demo/index.html, por ejemplo:

python -m http.server 4173 --directory demo
# o cualquier servidor estatico (npx serve demo, http-server demo, etc.)

Build/minificado

Genera el bundle ESM minificado en dist/air.min.js con:

npm run build

Se ejecuta automaticamente en npm publish via prepublishOnly.

Tests

npm test