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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mini-flip

v1.0.1

Published

Let google's freeze project on flip technology run again

Downloads

6

Readme

mini-flip

This is a great way to learn FLIP animation technology! It stems from Google's stop-and-maintain library, unfortunately it has been thrown into the frozen list and can't run.

中文 | English

FLIP

The FLIP technology will not be described again. If you are interested, you can read the following article:

1. CSS3 transition动画的FLIP动画学习,反转动画来解决动画的卡顿,闪烁。 2. FLIP Your Animations 3. FLIP技术给Web布局带来的变化 4. 让动画变得更简单之FLIP技术

mini-flip

I hope that with the simplest and clearest API and how to use it, I can easily get started with FLIP animation!

API

The core API is very simple and needs to be instantiated first.

const flip = new Flip(config)
  1. flip.play()

Record the current location information via getBoundingClientRect().

getBoundingClientRect will force the browser's queue to be refreshed for layout calculations, causing rearrangement redrawing, but we don't have to worry about performance loss.

  1. flip.last(lastClassName)

The information at the end of the record is also passed to getBoundingClientRect().

You can also pass the class here, as long as the target element has a layout change, call flip.last() directly.

  1. flip.invert()

Record changes, mainly x-axis and y-axis, as well as scaling ratio, poor transparency, etc.

  1. flip.play()

Let the target element move from the assumed initial position to the last position. The specific animation execution is provided by some simple, built-in animation rendering engines.

  1. flip.snapshot(lastClassName)

Equivalent to executionflip.first().last().invert()

👇 is some static method that needs to be called by Flip。

  1. Flip.version

get version

  1. Flip.extends(name, player)

Custom animation rendering extension

  1. Flip.player

Get all the animation engines

⚠️ Can be chained:flip.first().last().invert()

⚠️ first() last() invert() play() Must be called in order

How to customize the animation rendering engine

Very simple, just the following steps:

  1. To create an object, you must include a play function.
// a.js
export default {
  play() {

  }
}
  1. The object will bind the flip instance to this when you use the registration function Flip.extends('raf', RAF).
// a.js
export default {
  play() {
    console.log(this);
    // output:
    // _duration: 300, _delay: 0, _invert: {x: 34, y: 45, ...}
    // reference file in built-in folder

    // eg:
    const keyframes = [
        {
          transformOrigin: this._transformOrigin,
          transform: `
            translate(${this._invert.x}px, ${this._invert.y}px) 
            scale(${this._invert.sx}, ${this._invert.sy})
          `,
          opacity: this._first.opacity
        },
        {
          transformOrigin: this._transformOrigin,
          transform: 'none',
          opacity: this._last.opacity
        }
      ]

      const opts = {
        delay: this._delay,
        duration: this._duration,
        easing: this._easing
      }

      const _animate = this._target.animate(keyframes, opts)
    }
}
  1. Be sure to register your animation renderer before using it.
import A from 'a'
Flip.extends('A', A)
  1. Then when instantiating, tell mini-flip that you want to use your own animated renderer instead of the built-in
const flip = new Flip({
  //If you want to use your own renderer customPlay this field must be passed, and the value must be equal to the name you registered when ‘A’
  customPlay: 'A' 
})

// then,be happy!

demo

There are some cases in the demo folder, I will continue to add.

online demo list:

1. preview demo

todo

  • [ ] Distinguish private attributes, maybe use '#' is great way or ts?
  • [ ] Add physics animation engine
  • [ ] With React