Datasets:
Download data/val/codepen-XzxeNJ-OVpVBr/full.html from anim2code/dataset: direct link, hf CLI and curl.
- Browser
- Download file 3.21 kB
-
https://huggingface.co/datasets/anim2code/dataset/resolve/main/data/val/codepen-XzxeNJ-OVpVBr/full.html
- Command line
-
hf download hf://datasets/anim2code/dataset/data/val/codepen-XzxeNJ-OVpVBr/full.html
-
curl -L -o full.html https://huggingface.co/datasets/anim2code/dataset/resolve/main/data/val/codepen-XzxeNJ-OVpVBr/full.html
3.21 kB
| <html> | |
| <head> | |
| <style>body{ | |
| background-color:#2d2d2d; | |
| overflow:hidden; | |
| } | |
| body, html { | |
| height: 100%; | |
| width: 100%; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| svg{ | |
| width:100%; | |
| height:100%; | |
| } | |
| </style> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/TweenMax.min.js"></script> | |
| </head> | |
| <body> | |
| <svg xmlns="http://www.w3.org/2000/svg" | |
| x="0px" y="0px" viewBox="0 0 600 600"> | |
| <defs> | |
| <marker id="eye" width="26.4px" height="48px" viewBox="0 0 26.4 48" markerWidth="26.4" markerHeight="34" refX="10" refY="23" orient="auto" markerUnits="userSpaceOnUse"> | |
| <ellipse fill="#FFFFFF" cx="13.2" cy="8.5" rx="13.2" ry="8.5"/> | |
| <circle class="eyeR" cx="17" cy="10" r="3.4"/> | |
| <ellipse fill="#FFFFFF" cx="13.2" cy="39.5" rx="13.2" ry="8.5"/> | |
| <circle class="eyeL" cx="20.4" cy="39" r="3.4"/> | |
| </marker> | |
| <path id="bendyPath" d="M50,200c0,100,0,100,0,200" stroke-linecap="round" marker-start="url(#eye)" /> | |
| </defs> | |
| <use xlink:href="#bendyPath" stroke="red" x="0" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="orange" x="75" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="yellow" x="150" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="green" x="225" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="blue" x="300" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="indigo" x="375" y="0" fill="none" stroke-width="4" /> | |
| <use xlink:href="#bendyPath" stroke="violet" x="450" y="0" fill="none" stroke-width="4" /> | |
| </svg> | |
| <script>var container = document.querySelector('.container'); | |
| //we won't animate this beginning part of the path so we'll write it as a string | |
| var pathStart = 'M50,200c'; | |
| var pathEnd = ',0,200'; | |
| //center the container cos it's pretty an' that | |
| var eyeRollR = TweenMax.to(['.eyeL', '.eyeR'], 2, { | |
| transformOrigin:'10% 50%', | |
| rotation:'+=360', | |
| //repeat:-1, | |
| ease:Elastic.easeOut | |
| }) | |
| var eyeRollL = TweenMax.to(['.eyeL', '.eyeR'], 2, { | |
| transformOrigin:'10% 50%', | |
| rotation:'-=360', | |
| //repeat:-1, | |
| ease:Elastic.easeOut | |
| }) | |
| //make a nullObject to allow animation of values for the path | |
| var nullObject = {x1:0, y1:100, x2:0, y2:100}; | |
| //animate the values = the onUpdate calls the updateLines every frame | |
| var tl = new TimelineMax({repeat:-1, yoyo:true, onUpdate:updateLines}); | |
| tl.timeScale(1.16) | |
| tl.to(nullObject, 1, { | |
| x1:100, | |
| y1:'+=0', | |
| x2:-100, | |
| y2:'+=0', | |
| ease:Elastic.easeInOut | |
| }) | |
| .to(nullObject, 1, { | |
| x1:-100, | |
| y1:'+=0', | |
| x2:100, | |
| y2:'+=0', | |
| ease:Elastic.easeInOut | |
| }) | |
| .addCallback(rollEyesR, 0.5) | |
| .addCallback(rollEyesL, 1.5) | |
| //this is called onUpdate (every frame) of the animation and applies the values of nullObject to the path's d attribute | |
| //Note we're animating the originator and the <use> instances all update too - it's SO SWEET! | |
| function updateLines(){ | |
| TweenMax.set('#bendyPath', { | |
| attr:{ | |
| d:pathStart +nullObject.x1 + ',' + nullObject.y1 + ','+ nullObject.x2 + ',' + nullObject.y2 + pathEnd | |
| } | |
| }) | |
| } | |
| function rollEyesR(){ | |
| eyeRollR.play(0, true); | |
| } | |
| function rollEyesL(){ | |
| eyeRollL.play(0, true); | |
| }</script> | |
| </body> | |
| </html> |