Giter Site home page Giter Site logo

josephjlee / flippy.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from birjj/flippy.js

0.0 0.0 0.0 14.32 MB

FLIP animation helper; animate DOM changes with ease

Home Page: http://birjolaxew.github.io/flippy.js/

License: MIT License

JavaScript 100.00%

flippy.js's Introduction

FlippyJS

FlippyJS is a helper library for FLIP animations - it allows you to easily animate any changes you make to the DOM, without having to specify the animation manually. All animations are done using CSS animations.

It is exported as a UMD library, supporting both AMD, CommonJS and basic <script> usage.

Usage

Flippy.js exposes the function flip(elements, modifier, [options]). Pass it the elements you want to animate, a function which should modify the DOM when called, and an optional options object. It returns a Promise which resolves when the animation is finished.

For specifics, see our docs.

Here's a quick example:

const container = document.querySelector(".notification-container");
flip(
  ".notification", // the elements to animate
  ()=>{ // called when we should make the DOM change
    container.insertBefore(
      generateNotification(),
      container.firstChild
    );
  }
).then(()=>{
  console.log("Animation finished");
});

function generateNotification() { /* ... */ }

Advanced usage

Internally, FlippyJS uses a FLIPElement class to represent elements that are being animated. This class is exposed as flip.FLIPElement, should you wish to play around with it.

More details at our docs.

flippy.js's People

Contributors

birjj avatar martinherweg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.