js+css实现仓鼠滑竿选择器代码
代码语言:html
所属分类:其他
代码描述:js+css实现仓鼠滑竿选择器代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } body { padding: 0; margin: 0; font-family: sans-serif; background-color: #728194; color: white; --wheel-width: 160px; --handle-color: #3b4652; } p, h1, h2, h3, h4 { display: inline-block; margin-block-start: 0em; margin-block-end: 0em; margin-inline-start: 0px; margin-inline-end: 0px; padding-inline-start: 0px; } .wrapper { position: absolute; display: flex; justify-content: center; align-items: center; flex-direction: column; width: 100%; height: 100%; --hamster-speed: 0.25s; --wheel-speed: 0.5s; --wheel-angle: 0deg; } .pix, .pix:after { --m: 2; position: absolute; width: calc(var(--w) * var(--m)); height: calc(var(--h) * var(--m)); background-size: 100%; background-repeat: no-repeat; image-rendering: pixelated; } .puff { --w: 15px; --h: 14px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAOCAYAAADwikbvAAAAAXNSR0IArs4c6QAAAEhJREFUOE9jZEADjzZk/UcXg/HlAqYxIsvBOfg0oRsGMwSsmRSNyK5gJEcjzIBRzbgiGIf4AAYYRYkE5h1SEgtK8kQOD1IyBgBNBC/ng5m19gAAAABJRU5ErkJggg==); } :before, :after { position: absolute; content: ''; width: calc(var(--w) * var(--m)); height: calc(var(--h) * var(--m)); } .ear { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAAXNSR0IArs4c6QAAACJJREFUGFdjZGBgYHi0Ies/iAYBuYBpjIzIAjAJEgSxmQkAyjQQ9ygpCP0AAAAASUVORK5CYII=); --w: 5px; --h: 5px; top: -4px; left: 6px; } .hamster { display: flex; align-items: center; justify-content: space-between; padding: 8px; margin-bottom: 6px; z-index: 99; } .hamster:before { background: #693215; width: 3px; height: 4px; left: 5px; } .hamster:after { background: #693215; width: 6px; height: 2px; bottom: 7px; left: -3px; } .ear, .hamster:before, .hamster:after { animation: up-down infinite var(--hamster-speed); } .head, .bum { z-index: -1; top: 0px; animation: squidge var(--hamster-speed) infinite; } .hamster div:after { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAGCAYAAADkOT91AAAAAXNSR0IArs4c6QAAACFJREFUGFdjZGBgYHi0Ies/iJYLmMbICOOABECAHAF0QwFBIRPzdQwRVAAAAABJRU5ErkJggg==); --w: 4px; --h: 6px; bottom: -4px; animation: run var(--hamster-speed) infinite; } .head { left: -5px; --angle: 10deg; } .bum { right: -5px; --angle: -10deg; /* filter: invert(1); */ } .head:after { left: 8px; --run-x: -2px; --angle: 6deg; } .bum:after { right: 6px; --run-x: 2px; --angle: -6deg; } @keyframes squidge { 0%, 100% { transform: rotate(var(--angle)) translateY(-1px); } 50% { transform: rotate(0) translateY(0); } } @keyframes run { 0%, 100% { transform: translateX(var(--run-x)) rotate(var(--angle)); } 50% { transform: translateX(0) rotate(0); } } @keyframes up-down { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(0); } } .wheel-frame { position: relative; --w: 80px; --h: 80px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAAAn5JREFUeF7t3NtygzAMBNDy/x9NJnScIeCLVisZkmyfbdk6LHGbkC5/N/lZ13VFtrIsy4KMzxp7ySZqWChIRI0I1GmA+4ZRLGujM9Y47iUdsDSVhdbCnbVuGuCsBkbpzN5HOGD2hkdgsxMZBnhXuCNo9D5DAJ+bmv0a501imRe1Zwow+mqyKOj8iP27AaOuINp0xnimFxcgs2AGQERNb08woHehiCaza3h6gwA9C2Q3HV0f7dEMiBaObmxmPaRXEyBScGajmWtZex4CWgtlNnNVbUvvAuxcHRrQUuCqdMxad2TQTOBo4qwG7rBOz0KAhisEAyp9Z9WWSTWBAiQAhde+p2s2pwQKkAAU3vhEORq9JVCABKDwxni1jwNeCRSgAO0C5Mh92LYEKn24aDETIG63zRCgE+54kCiBTkgl0Al3SqAOEL/kZidAAfoFyJlKoABJAXK6EihAUoCcrgQKkBQgpyuBAiQFyOlKYASg3lD1KerdGJ/ba5YABUgKkNOVwEhAHSSY5uljTQEKEBMgR1cTqBTaVPV0ls2pOaoLqBT2dfWEanD6nuX0kLkRVU/pG6FawyBAvRa+M/YePtA3lQzJdAEqhf+yo0df9HXXTgJHeM1TeF/TUsRwF3zkEEvvwwRaYvyROoNNW/BMCSzrWAt+AybSqymBv4SI4EEJ/AVEFM8F+K2viR48N+C3IXrxKMCCuBW5yb8kRg+wJxy7f+gQQf/QRhuaOZ5J3X6fIYCflMaI1KUA7k9p9rbISGI0XNljWAKPTWdtGMXN3kca4NWJzIZLT2ArkZm3d0HLXOPYV3oCa7fcvtHXlQR/FYqogb4c1MZfAmhF7TV4l989H/4WeD/sciFJAAAAAElFTkSuQmCC); margin-bottom: 16px; pointer-events: none; } .wheel { width: 160px; height: 160px; display: flex; justify-content: center; align-items: end; transform: rotate(var(--wheel-angle)); } .wheel.spinning { animation: spin var(--wheel-speed) infinite linear; } .wheel.spinning .hamster { animation: none; } .wheel-supp.........完整代码请登录后点击上方下载按钮下载查看
网友评论0