A polyfill of ScrollTimeline as defined by the spec.
View a cool demo showing its usage!
To play with ScrollTimeline, simply import the module into your site and you can start creating animations.
import 'https://flackr.github.io/scroll-timeline/scroll-timeline.js';
document.getElementById('parallax').animate(
{ transform: ['translateY(0)', 'translateY(100px)']},
{ duration: 10000, // Totally arbitrary!
fill: 'both',
timeline: new ScrollTimeline({
endScrollOffset: '200px'})
});
Running a dev environment
npm i
npm run dev
Then open the browser http://localhost:5000
, choose one of the demos (test) to see how your changes.
Test configurations are available in: test/tests.config.json
that file includes:
- polyfillFiles: an array of our JS shim / polyfill files, those will be injected in WPT tests files.
- harnessTests: an array of WPT harness tests we want to test the polyfill against.
- browsers.local: Browser our local selenium-webdriver will test against
- browsers.sauce: Browser our local selenium-webdriver will test against in Saucelabs / CI environment.
Simple test will serve the WPT tests folder and intercepts requests, if the request path matches a harness test we are interested in polyfilling, it will inject the polyfill.
Required environment variables:
WPT_DIR=test/wpt #defaults to test/wpt
WPT_SERVER_PORT=8081 # choose any port available on your machine
Command
npm run test:simple
Go to localhost:8081/scroll-animations/current-time-nan.html
as an example.
Required environment variables:
WPT_DIR=test/wpt #defaults to test/wpt
WPT_SERVER_PORT=8081 # choose any port available on your machine
LOCAL_BROWSER=chrome # choose one of 'chrome', 'edge', 'firefox', 'safari'
LOCAL_WEBDRIVER_BIN=? #/path/to/webdriver-binaries
Command
npm run test:webdriver
Required environment variables:
TEST_ENV=sauce
WPT_DIR=test/wpt #defaults to test/wpt
WPT_SERVER_PORT=8081 # choose any port available on your machine
SC_TUNNEL_ID=sc-wpt-tunnel # please specify 'sc-wpt-tunnel' as a SauceConnect Proxy Tunnel ID
SAUCE_NAME=<secret> # Your saucelabs account username
SAUCE_KEY=<secret> # Your API key
Command
TEST_ENV=sauce npm run test:webdriver