1.0.3 • Published 2 years ago

fy-animate v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

fy-animate

NPM version NPM Weekly Downloads License

A simple patch animation running in the browser

Install with npm, or Yarn:

# via npm
npm install fy-animate --save

# or Yarn (note that it will automatically save the package to your `dependencies` in `package.json`)
yarn add fy-animate

Usage

    import Animate from 'fy-animate';
    const div = document.querySelector('div');
    const animate1 = new Animate(div);
    // const animate2 = new Animate(div);

    animate1.start('left', 500, 2000, 'linear');
    // animate2.start('top', 400, 2000, 'easeInOut');

Params

PropertyTypeRequired?Description
propertyNameStringDOMRect(Attributes included in Element.getBoundingClientRect())
endPosNumberTarget location
durationNumberTotal duration of animation
easingString/FunctionEasing function.Or a string from ['linear', 'easeIn', 'easeOut', 'easeInOut', 'strongEaseIn', 'strongEaseOut', 'sineaseIn', 'sineaseOut']
unitStringUnit of propertyName with the default value: 'px'

Example

demo1

demo2

To see an example of the code running, follow these steps:

  1. Clone the repo, https://github.com/strivefighting/fy-animate.git
  2. cd examples
  3. npm install
  4. npm run dev
  5. Open http://localhost:8080

The code of the example is in fy-animate.

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago