1.0.3 • Published 5 years ago

@tianfanfan/scroll-to-with-animation v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

scroll-to-with-animation

Some plugins for vuex store.

How to use

$ npm install -S @tianfanfan/scroll-to-with-animation

Example

import scrollToTop from '@tianfanfan/scroll-to-with-animation'
// Base use
scrollToTop(0, 2000)

// animationname from https://github.com/danro/easing-js/blob/master/easing.js
scrollToTop(0, 2000, 'easeOutSine')

// FULL use
scrollToTop(0, 2000, 'easeOutSine', window, ()=>{console.log('scroll end')})

Attribute

  • smoothScrollTo(to, speed, animationName, el);
  • to : target scrollY (0 means top of the page, default 0)
  • speed : scroll speed (default 2000),more bigger meas more quick
  • animationName: + linearTween + easeInQuad + easeOutQuad + easeInOutQuad + easeInCubic + easeOutCubic + easeInOutCubic + easeInQuart + easeOutQuart + easeInOutQuart + easeInQuint + easeOutQuint + easeInOutQuint + easeInSine + easeOutSine + easeInOutSine + easeInExpo + easeOutExpo + easeInOutExpo + easeInCirc + easeOutCirc + easeInOutCirc
  • el : scroll element (default window)
  • callbackfunction: a function which will call at the end of animation

License

MIT

1.0.3

5 years ago

1.0.2

5 years ago