css实现一个卡通小宝宝眨眼效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现一个卡通小宝宝眨眼效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @-webkit-keyframes blinky { 0%, 9%, 11%, 19%, 21%, 69%, 71%, 100% { transform: scaleY(1); } 10%, 20%, 70% { transform: scaleY(0); } } @keyframes blinky { 0%, 9%, 11%, 19%, 21%, 69%, 71%, 100% { transform: scaleY(1); } 10%, 20%, 70% { transform: scaleY(0); } } :root { --black: #9a4c32; --white: #fff; --primary-color: #f26d40; --primary-color-dark: #ee4811; --primary-color-tint: #f79655; --accent-color: #fbe89d; --background: #f8b6a0; --mouth-inner-color: #f5879b; --nose-color: #f5879b; --blush-color: #f5879b; --shadow-color: hsl(266, 21%, 95%); } * { box-sizing: border-box; } body { display: grid; place-items: center; height: 100vh; background-color: var(--background); font-size: 16px; line-height: 1; } .scor { --ear-size: 9rem; position: relative; padding-top: calc(var(--ear-size) + 2rem); padding-bottom: 3rem; } .scor::after { content: ""; position: absolute; z-index: -1; bottom: 1.75rem; left: 50%; height: 2rem; width: 50%; transform: translateX(-50%); border-radius: 100%; background-color: var(--primary-color); opacity: 0.2; } .scor-eye { border-top-left-radius: 50% 55%; border-top-right-radius: 50% 55%; border-bottom-right-radius: 50% 45%; border-bottom-left-radius: 50% 45%; --eye-position-x: 2rem; position: absolute; z-index: 2; top: 4.75rem; height: 1.875rem; width: 1.75rem; background-color: var(--black); transform-origin: center 70%; overflow: hidden; -webkit-animation: blinky 7s infinite; animation: blinky 7s infinite; } .scor-eye::before, .scor-eye::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border-radius: 100%; } .scor-eye::before { top: 0.125rem; height: 40%; width: 40%; background-color: var(--white); } .scor-eye::after { bottom: -0.125rem; height: 40%; width: 70%; background-color: var(--primary-color); } .scor-eye-left { left: var(--eye-position-x); } .scor-eye-right { right: var(--eye-position-x); } .scor-nose { position: relative; z-index: 5; top: 0; height: 1rem; width: 1rem; } .scor-nose::before, .scor-nose::after { content: ""; } .scor-nose::before { position: absolute; top: 0; left: 0; height: 100%; width: 100%; transform: rotate(45deg); border-top-left-radius: 80%; border-top-right-radius: 0.1875rem; border-bottom-left-radius: 0.1875rem; border-bottom-right-radius: 0.25rem; background-color: var(--nose-color); } .scor-nose::after { position: absolute.........完整代码请登录后点击上方下载按钮下载查看
网友评论0