css实现橡胶泡泡点击伸缩有弹性动画效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现橡胶泡泡点击伸缩有弹性动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --main-bg: #000000; --pink: 255, 0, 89; --violet: 186, 0, 253; --blue: 0, 165, 253; --yellow: 255, 200, 0; --light: 255, 255, 255; --alpha: .5; } html { box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; margin: 0; padding: 0; } body { display: flex; justify-content: center; align-items: center; gap: 2rem; min-height: 100vh; background-color: var(--main-bg); } .bubble { position: relative; width: 20rem; height: 20rem; border-radius: 50%; box-shadow: inset 0 0 2rem rgba(var(--light), 1), inset 2rem 0 4rem rgba(var(--pink), 1), inset -2rem 0 6rem rgba(var(--blue), 1), inset 0 4rem 4rem rgba(var(--violet), 1), inset 0 -2rem 2rem rgba(var(--yellow), 1), inset 2rem -2rem 1rem rgba(var(--yellow), 1), 0 0 4rem rgba(var(--light), .2), 2rem 0 8rem rgba(var(--pink), var(--alpha)), -2rem 0 8rem rgba(var(--blue), var(--alpha)), 0 4rem 8rem rgba(var(--violet), var(--alpha)), 0 -2rem 8rem rgba(var(--yellow), var(--alpha)); animation: floating 3s ease-in-out infinite; cursor: pointer; } .bubble.animated { animation: rubber 1s linear; } @keyframes rubber { from { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); } 30% { -webkit-transform: scale3d(1.25, 0.75, 1); transform: scale3d(1.25, 0.75, 1); } 40% { -webkit-transform: scale3d(0.75, 1.25, 1); transform: scale3d(0.75, 1.25, 1); } 50% { -webkit-tr.........完整代码请登录后点击上方下载按钮下载查看
网友评论0