1.0.15 • Published 6 years ago

fizzeroll v1.0.15

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

Fizzeroll - Ultimate On Scroll Animation Library

Easily animate your HTML elements on scroll. This library was built on top of GSAP animation library.

Installing

CDN

<body>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
<script src="https://unpkg.com/fizzeroll/umd/fizzeroll.min.js"></script>
...
</body>

*Make sure to include GSAP before including this library, as shown above

If you are using node modules:

npm i fizzeroll

Usage

Example of how to configure and initialize animation

React:

import Fizzeroll from 'fizzeroll'

class App extends Component {

  componentDidMount(){
    Fizzeroll.init()
  }

  render() {
    <div>
      <div fizzeroll='{"duration": 0.5, "movement": [100, -100], "fade": true, "ease": ["Power2", "easeOut"]}'></div>
    </div>
  }

}

If you want to reset the animation on scroll top set 'fizzeroll-top-reset' as attribute on body tag

example:

  <body fizzeroll-top-reset>
  ...
  </body>

To apply animation on JavaScript:

  Fizzeroll.apply(element, configurations)

example:

  Fizzeroll.apply(document.getElementById('animationEl'), {duration: 0.5, movement: [100, -100], fade: true, ease: ["Power2", "easeOut"]})

This library also supports stagger animation, simply set the configuration on parent element, all children will be automatically animated in stagger fashion

example:

    <div fizzeroll='{"duration": 0.5, "movement": [100, -100], "fade": true, "ease": ["Power2", "easeOut"], "type": "stagger", "staggerDelay": 0.2}'>

      <div>I AM ANIMATED CHILD</div>
      <div>I AM ANIMATED CHILD</div>
      <div>I AM ANIMATED CHILD</div>
      <div>I AM ANIMATED CHILD</div>

    </div>

Stagger animation can be implemented with text element, text will be automatically split into letters and animated

example:

  <p fizzeroll='{"duration": 0.5, "movement": [100, -100], "fade": true, "ease":    ["Power2", "easeOut"], "type": "stagger", "staggerDelay": 0.2}'>
    THIS TEXT IS SPLIT INTO LETTERS AND ANIMATED
  </p>

if you want to split the text by word, add {"splitByWord": true}

example:

  <p fizzeroll='{"duration": 0.5, "movement": [100, -100], "fade": true, "ease":    ["Power2", "easeOut"], "type": "stagger", "staggerDelay": 0.2, "splitByWord": true}'>
    THIS TEXT IS SPLIT INTO WORDS AND ANIMATED
  </p>

Animation Parameters

KeyValue TypeExampleDescription
durationNumber0.5How long it takes for animation to finish
movementNumber[] (x, y)100, -100Direction of animation defined in X and Y
fadeBoolean (true / false)trueWhether the element is fading from 0 to its original opacity
scaleNumber0.5Whether the element is scaling to its original scale
typeString"stagger"Type of animation
splitByWordBoolean (true / false)trueWhether stagger animation split text by word
easeString[] (name, style, config)'Elastic', 'easeOut', 'config(1, 0.3)'Ease style (Check GSAP website for more ease style)
allowMobileBoolean (true / false)trueWhether animation runs on mobile
delayNumber2How long it takes before animation starts after activation
offsetNumber200How far it takes (scroll) before animation is activated
staggerDelayNumber0.2How long it takes between staggered child
playbackBooleantrueWhether animation replays after element is below the viewport and then back in the viewport
parallaxNumber1How fast the element moves in parallax fashion as user scrolls

Author

License

This project is licensed under the MIT License

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago