Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tinyanims

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinyanims

Animation primitives for browsers

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Animation primitives for browsers

Install

$ yarn add tinyanims

Extremely tiny (279 bytes minified & gzip'd) library that exposes some basic methods for doing animations. Exports a global 'tinyanims' when dumped in your page as a script tag.

Requires requestAnimationFrame.

Docs

tween(callback, milliseconds = 500)

lerp(start, end, delta)

ease(delta)

Usage

import { tween, lerp, ease } from 'tinyanims';

// log a bunch of numbers from -20 to 100

tween((t) => {
    const i = lerp(-20, 100, t);
    console.log(i);
}, 1000);

// create some text and do a repeating animation

const txt = document.body.appendChild(Object.assign(
    document.createElement('span'),
    { textContent: 'hello' },
));

~function loop () {
    tween((t) => {
        const i = lerp(20, 30, ease(t));
        txt.style.fontSize = `${i}px`;

        if (t == 1) {
            loop();
        }
    });
} ();

FAQs

Package last updated on 04 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc