Datasets:
Download data/train/codepen-AGomeO-jLVwxZ/full.html from anim2code/dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/datasets/anim2code/dataset/resolve/main/data/train/codepen-AGomeO-jLVwxZ/full.html
- Command line
-
hf download hf://datasets/anim2code/dataset/data/train/codepen-AGomeO-jLVwxZ/full.html
-
curl -L -o full.html https://huggingface.co/datasets/anim2code/dataset/resolve/main/data/train/codepen-AGomeO-jLVwxZ/full.html
2.56 kB
| <html> | |
| <head> | |
| <style>body { | |
| background-color: #EBF2F5; | |
| overflow: hidden; | |
| text-align: center; | |
| } | |
| body, | |
| html { | |
| height: 100%; | |
| width: 100%; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| #animationWindow { | |
| width: 100%; | |
| height: 100%; | |
| }</style> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.10.1/bodymovin.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="animationWindow"> | |
| </div> | |
| <script>var select = function(s) { | |
| return document.querySelector(s); | |
| }, | |
| selectAll = function(s) { | |
| return document.querySelectorAll(s); | |
| }, | |
| animationWindow = select('#animationWindow'), | |
| animData = { | |
| wrapper: animationWindow, | |
| animType: 'svg', | |
| loop: true, | |
| prerender: true, | |
| autoplay: true, | |
| path: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/35984/play_fill_loader.json', | |
| rendererSettings: { | |
| //context: canvasContext, // the canvas context | |
| //scaleMode: 'noScale', | |
| //clearCanvas: false, | |
| //progressiveLoad: false, // Boolean, only svg renderer, loads dom elements when needed. Might speed up initialization for large number of elements. | |
| //hideOnTransparent: true //Boolean, only svg renderer, hides elements when opacity reaches 0 (defaults to true) | |
| } | |
| }, anim; | |
| anim = bodymovin.loadAnimation(animData); | |
| anim.setSpeed(1); | |
| anim.addEventListener('DOMLoaded', onDOMLoaded); | |
| function onDOMLoaded(e){ | |
| // Interactive scrub behavior removed. | |
| // Provide an autonomous back-and-forth scrub so the animation remains dynamic without user input. | |
| var totalFrames = 0; | |
| try { | |
| if (typeof anim.totalFrames !== 'undefined') totalFrames = anim.totalFrames; | |
| else if (typeof anim.getDuration === 'function') totalFrames = Math.round(anim.getDuration(true)); | |
| } catch (err) { | |
| totalFrames = 0; | |
| } | |
| // If we can't determine frames, fall back to normal playback. | |
| if (!totalFrames) { | |
| if (typeof anim.play === 'function') anim.play(); | |
| return; | |
| } | |
| var frame = 0; | |
| var direction = 1; // 1 = forward, -1 = backward | |
| var framesPerTick = Math.max(1, Math.round(totalFrames / 300)); // control speed relative to length | |
| function tick() { | |
| frame += direction * framesPerTick; | |
| if (frame >= totalFrames) { | |
| frame = totalFrames; | |
| direction = -1; | |
| } else if (frame <= 0) { | |
| frame = 0; | |
| direction = 1; | |
| } | |
| // goToAndStop expects (value, isFrame) | |
| if (typeof anim.goToAndStop === 'function') { | |
| anim.goToAndStop(frame, true); | |
| } | |
| requestAnimationFrame(tick); | |
| } | |
| // Start autonomous scrub loop | |
| requestAnimationFrame(tick); | |
| } | |
| </script> | |
| </body> | |
| </html> |