Tiny Javascript tweening engine.

Overview

Weeee.js

Tiny Javascript tweening engine.

Homepage

Weeee.js

Usage

Step 1:

npm install --save weeee.js

Step 2:

import Weeee from 'weeee.js';

const example = new Weeee({
    // <time in ms>
    // Infinity
    duration: 1000,

    //  <time in ms>
    delay: 0,

    //  Weeee.easeLinear
    //  Weeee.easeInCubic
    //  Weeee.easeOutCubic
    //  Weeee.easeInExpo
    //  Weeee.easeOutExpo
    //  Weeee.easeInElastic
    //  Weeee.easeOutElastic
    //  <any other f(x), which returns values from 0 to 1>
    easing: Weeee.easeLinear,

    //  Weeee.normal
    //  Weeee.reverse
    //  Weeee.alternate
    direction: Weeee.normal,

    //  true
    //  false
    autoplay: true,

    //  false
    //  <number of iterations>
    //  Infinity
    loop: false,

    // <time in ms>
    loopDelay: 0,

    //  <number from 1 to 60>
    fps: 60,

    //  <function(progress, details)>
    //
    // Weeee doesn't force us to manipulate with specific CSS, SVG,
    // Canvas or WebGL objects. Just do whatever you want here.
    //
    // Progress will be from 0 to 1.
    //
    // Additional details include:
    //  - startTime (when animation has been started, in ms)
    //  - currentTime (current time, may bee needed in infinite animations, in ms)
    //  - delta (time from the start, "currentTime - startTime", in ms)
    //  - isFinished (becomes true in the last frame of the finite animation)
    func: (progress, details) => {
        myElement.style.transform = `scale(${progress})`;
    },

    // Optional callback. It will be executed after the last frame of the animation.
    callback: () => {
        console.log('weeee!');
    }
});

// Also it's possible to start/stop/restart it manually. Callback will NOT be executed.
//
// example.start();
// example.stop();
// example.restart();

CDN

It's possible to import Weeee right from the unpkg:

import Weeee from 'https://unpkg.com/weeee.js/weeee.js';

More examples

Examples on CodePen:

  1. Page loading
  2. Spinner

License

MIT License

Copyright (c) 2021 Ivan Bogachev [email protected]

You might also like...

GreenSock's GSAP JavaScript animation library (including Draggable).

GreenSock's GSAP JavaScript animation library (including Draggable).

GSAP (GreenSock Animation Platform) Professional-grade animation for the modern web GSAP is a robust JavaScript toolset that turns developers into ani

Jan 5, 2023

Pure CSS (no JavaScript) implementation of Android Material design "ripple" animation

Pure CSS (no JavaScript) implementation of Android Material design

Pure CSS (no JavaScript) implementation of Android Material design "ripple" animation

Dec 11, 2022

simple JavaScript library to animate texts

simple JavaScript library to animate texts

Animated Texts Hi, this library is a simple javascript text animator Properties force type: number default: 300 start_delay_time type: number default:

Jan 11, 2022

Slickscroll - A Lightweight JavaScript library for quick and painless momentum & parallax scrolling effects.

Slickscroll - A Lightweight JavaScript library for quick and painless momentum & parallax scrolling effects.

Slickscroll is a JavaScript library that makes momentum & parallax scrolling quick and painless View Demo: slickscroll.musabhassan.com Momentum Scroll

Dec 28, 2022

Animate Plus is a JavaScript animation library focusing on performance and authoring flexibility

Animate Plus Animate Plus is a JavaScript animation library focusing on performance and authoring flexibility. It aims to deliver a steady 60 FPS and

Jan 2, 2023

Vector, matrix and geometry math JavaScript

Sylvester Vector and Matrix math for JavaScript. See the website for documentation. Development Sylvester is built using wake and tested with jstest.

Dec 28, 2022

Nebula is a lightweight (1kb compressed) JavaScript library that creates beautiful universe animations.

 Nebula is a lightweight (1kb compressed) JavaScript library that creates beautiful universe animations.

Nebula is a lightweight JavaScript library for creating beautiful universe animations. Including configurable Stars, Nebulas, Comets, Planets and Suns. Compatible with SSR

Nov 25, 2022

Javascript version of the Move language compiler, supports compiling Move code into Move bytecode in the browser.

move-js Javascript version of the move language compiler, supports compiling Move code into move bytecode in the browser. Features Compiling move pack

Dec 20, 2022

Create scroll-based animation without JavaScript

Create scroll-based animation without JavaScript

Trigger JS Create scroll-based animation without JavaScript. Sometimes we want to update the CSS style of an HTML element based on the scroll position

Jan 4, 2023
Owner
Ivan Bogachev
Creative frontend developer
Ivan Bogachev
Tiny ANSI terminal coloring library

felt-pen Tiny ANSI terminal coloring library Benchmarks Calling chalk 1,192,251 ops/sec cli-color 130,947 ops/sec ansi-colors 683

nin-jin 15 Aug 7, 2022
Animator Core is the runtime and rendering engine for Haiku Animator and the components you create with Animator

Animator Core is the runtime and rendering engine for Haiku Animator and the components you create with Animator. This engine is a dependency for any Haiku Animator components that are run on the web.

Haiku 757 Nov 27, 2022
A lightweight JavaScript library for creating particles

particles.js A lightweight JavaScript library for creating particles. Demo / Generator Configure, export, and share your particles.js configuration on

Vincent Garreau 26.7k Jan 8, 2023
Accelerated JavaScript animation.

Velocity beta NPM: npm install velocity-animate@beta Docs https://github.com/julianshapiro/velocity/wiki IMPORTANT: The velocityjs.org documentation r

Julian Shapiro 17.2k Jan 5, 2023
GreenSock's GSAP JavaScript animation library (including Draggable).

GSAP (GreenSock Animation Platform) Professional-grade animation for the modern web GSAP is a robust JavaScript toolset that turns developers into ani

GreenSock 15.5k Jan 8, 2023
Javascript library to create physics-based animations

Dynamics.js Dynamics.js is a JavaScript library to create physics-based animations To see some demos, check out dynamicsjs.com. Usage Download: GitHub

Michael Villar 7.5k Jan 6, 2023
CSS3 backed JavaScript animation framework

Move.js CSS3 JavaScript animation framework. About Move.js is a small JavaScript library making CSS3 backed animation extremely simple and elegant. Be

Sloth 4.7k Dec 30, 2022
Javascript and SVG odometer effect library with motion blur

SVG library for transitioning numbers with motion blur JavaScript odometer or slot machine effect library for smoothly transitioning numbers with moti

Mike Skowronek 793 Dec 27, 2022
🐿 Super easy and lightweight(<3kb) JavaScript animation library

Overview AniX - A super easy and lightweight javascript animation library. AniX is a lightweight and easy-to-use animation library with excellent perf

anonymous namespace 256 Sep 19, 2022
Responsive, interactive and more accessible HTML5 canvas elements. Scrawl-canvas is a JavaScript library designed to make using the HTML5 canvas element a bit easier, and a bit more fun!

Scrawl-canvas Library Version: 8.5.2 - 11 Mar 2021 Scrawl-canvas website: scrawl-v8.rikweb.org.uk. Do you want to contribute? I've been developing thi

Rik Roots 227 Dec 31, 2022