Engine to register animations that are driven by scroll. That means that animation progress is dragged or progress change is triggered by scroll.
Originally part of an animated header which transitioned from a big state to a small state based on user scroll.
Code is not yet as clean and well structured as I'd like to have it, but it works.
Let's see where this project goes.
Supports all major browsers, including IE11 and iOS Safari 8+
This project (and it's dependencies, especially popmotion) make use of some ES6 functionality that needs to be polyfilled in older Browsers:
- Map
- WeakSet
- WeakMap
- Math.sign
- Symbol.iterator
- Array.prototype.@@iterator
You can polyfill it using polyfill.io:
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,WeakSet,WeakMap,Math.sign,Symbol.iterator,Array.prototype.@@iterator"></script>
- Debug Log statements are still included in production bundle, DCE not working good enough to catch them
- I think we can use an array instead of an set for the animations
- cleanup code
- maybe a class is the wrong idea, since multiple instances don't really make sense
- store dom references globally in the engine, not per animation
- currently, two animations can have the same dom references => duplicated objects
The engine includes a demo animation (the animation the engine was developed for) in demo
folder.
Online demo: https://simonselg.github.io/ScrollAnimationEngine/
# clone repo
git clone [email protected]:SimonSelg/ScrollAnimationEngine.git && cd ScrollAnimationEngine
# setup demo/dist subtree for gh-pages
git worktree add demo/dist gh-pages
yarn build
builds the libraryyarn clean
clean build artifactsyarn demo:start
starts the dev serveryarn demo:build
builds the demo in demo/distyarn demo:publish
publish demo to Github Pages