mac finder布局动画效果
代码语言:html
所属分类:布局界面
代码描述:mac finder布局动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap"); *, *:after, *:before { box-sizing: border-box; } :root { --size: 200; --height: 200; --width: calc(var(--height) * 1.14); --face-color-one: linear-gradient(0deg, #1982eb, #4dd3f5); --face-color-two: #ededed; --distance: 0; } body { display: -webkit-box; display: flex; min-height: 100vh; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; font-family: 'Roboto Mono', monospace; } .backdrop { height: 100vh; width: 100vw; background: #808080; position: fixed; -webkit-transition: background 0.25s ease, color 0.25s ease; transition: background 0.25s ease, color 0.25s ease; color: #a6a6a6; } img { height: calc(var(--height) * 1px); position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); opacity: 0.5; } h1 { margin: 0; right: 1rem; bottom: 1rem; position: fixed; } @media (max-width: 768px) { h1 { font-size: 1rem; } } [type='checkbox'] { position: fixed; top: 1rem; left: 1rem; height: 0; width: 0; opacity: 0; } :checked ~ label { --distance: 50; } @media (min-width: 768px) { :checked ~ label { --distance: 100; } } :checked ~ .backdrop { background: #a1e87d; color: #a1e87d; } label { cursor: pointer; height: 100vh; width: 100vw; position: relative; } .face { height: calc(var(--height) * 1px); width: calc(var(--width) * 1px); background: var(--face-color-one); position: absolute; top: 50%; left: 50%; border-radius: 5%; -webkit-transform: translate(-50%, -50%) translate(calc(var(--distance) * -1%), 0); transform: translate(-50%, -50%) translate(calc(var(--distance) * -1%), 0); } .face__eye { background: #000; position: absolute; width: 4%; height: 14%; left: 50%; top: 50%; -webkit-transform: translate(-648%, -228%); transform: translate(-648%, -228%); border-radius: 50% 50% 50% 50%/20% 20% 20% 20%; } .face__eye--right { -webkit-transform: translate(458%, -228%); transform: translate(458%, -228%); } .face, .side { overflow: hidden; -webkit-transition: -webkit-transform 0.25s ease; transition: -webkit-transform 0.25s ease; transition: transform 0.25s ease; transition: transform 0.25s ease, -webkit-transform 0.25s ease; } .face__mouth, .side__mouth { position: absolute; height: calc(var(--height) * 1px); width: calc(var(--width) * 1px); top: 0; left: 0; -webkit-clip-path: polygon(50% -40%, 0% 100%, 100% 100%); clip-path: polygon(50% -40%, 0% 100%, 100% 100%); } .face__mouth:after, .side__mouth:after, .face__mouth:before, .side__mouth:before { content: ''; height: 10px; width: 10px; border-radius: 50%; position: absolute; top: 50%; left: 50%; background: #000; } .face__mouth:after, .side__mouth:after { -webkit-transform: translate(-800%, -170%); transform: translate(-800%, -170%); } .face__mouth:before, .side__mouth:before { -webkit-transform: translate(700%, -170%); transform: translate(700%, -170%); } .face__mouth-opening, .side__mouth-opening { position: absolute; border: 10px solid #.........完整代码请登录后点击上方下载按钮下载查看
网友评论0