EyeDropper吸管取色器注入液体动画效果代码
代码语言:html
所属分类:动画
代码描述:EyeDropper吸管取色器注入液体动画效果代码,通过EyeDropper api获取屏幕任意区域颜色,然后产生注入水滴动画。
代码标签: EyeDropper 吸管 取色器 注入 液体 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --color: wheat; --ink-load-time: .5s; --ink-fill-time: 2.5s; --ripple-time: 1.5s; } body { margin: 0; overflow: hidden; background: var(--color); transition: background 0s calc(var(--ink-load-time) + var(--ink-fill-time)); font-family: sans-serif; } .ink { height: 100vh; background: var(--color); transition: transform var(--ink-fill-time) var(--ink-load-time) cubic-bezier(0.53, 0.03, 0.95, 0.23); } body:not(.filled) .ink { transform: translateY(100%); transition: none; } .ripple { position: absolute; left: 50%; translate: -50%; top: 0; width: 60vh; aspect-ratio: 20 / 1; display: flex; justify-content: space-between; } body.filled .ripple { animation: ripple linear var(--ripple-time) calc(var(--ink-load-time) + var(--delay)); } @keyframes ripple { 5%, 100% { transform: translateY(-98%); } } .ripple-ridge { fill: var(--color); animation: inherit; transform-origin: bottom; } body.filled .ripple-ridge:first-child { animation-name: ripple-ridge-left; } body.filled .ripple-ridge:last-child { animation-name: ripple-ridge-right; } @keyframes ripple-ridge-left { 5% { transform: translateX(20%); } 100% { transform: translateX(-50vw) scale(3, 0.3); visibility: hidden; } } @keyframes ripple-ridge-right { 5% { transform: translateX(-20%); } 100% { transform: translateX(50vw) scale(3, 0.3); visibility: hidden; } } .eyedropper-fill { fill: var(--color); stroke: hsl(0 0% 100% / .6); } .eyedropper-cap { stroke: hsl(230 60% 55%); } .eyedropper { position: absolute; top: 5%; left: 50%; transform: translate(-50%); transition: .25s; display: grid; grid-template-columns: 1fr; align-items: end; justify-items: center; cursor: pointer; } .eyedropper:is(:hover, :focus-visible) { outline: none; translate: 0 -5px; } .eyedropper > * { grid-row-start: 1; grid-column-start: 1; } .eyedropper-loader { align-self: stretch; justify-self: stretch; clip-path: polygon(var(--pipette-polygon)); } .eyedropper-loader::after { content: ""; position: absolute; top: 0; width: 100%; height: 200%; background: repeating-linear-gradient(155deg, red 0 4%, orange 4% 11%, yellow 11% 18%, green 18% 25%, blue 25% 32%, purple 32% 39%, red 39% 42%); transition: opacity .25s; animation: load 1s linear infinite; } body:not(.loading) .eyedropper-loader::after { opacity: 0; } @keyframes load { to { translate: 0 -46%; } } .eyedropper-svg { display: block; width: auto; height: 40vh; fill: none; stroke: black; } .droplet { z-index: -1; width: 3vh; height: calc(var(--i) * 2vh + 4vh); background: var(--color, green); border-radius: 999px; transition: transform ease-out .4s calc(var(--ink-load-time) + var(--delay)); } .droplet:nth-last-child(1 of .droplet) { height: 40vh; } body.filled .droplet:nth-last-child(1 of .droplet) { transform: translateY(35vh); transition-duration: .2s; } body.filled .droplet { transform: translateY(70vh); } body:not(.filled) .droplet { transition: none; } .bubble { position: absolute; width: var(--size); height: var(--size); left: 0; top: 0; translate: calc(var(--x) * calc(100vw - 100%)) calc(var(--y) * calc(100vh - 100%)); background-color: var(--color); border-radius: 999px; animation: float infinite alternate linear 7s var(--delay); } @keyframes float { to { transform: translateY(20px); } } .intro { position: absolute; inset: 0; display: grid; place-content: center; pointer-events: none; } .intro-content { margin-top: 15vh; padding: 1em; font-size: 1.2rem; backdrop-filter: blur(7px); background: hsl(39 80% 58% / .5); border-radius: 10px; color: hsl(39 100% 8%); animation: show .25s 3s backwards; } @keyframes show { from { visibility: hidden; opacity: 0; transform: scale(0); } } .emoji { color: transparent; text-shadow: 0 0 0 hsl(39 100% 8%); } .no-support { display: none; position: absolute; bottom: 0; left: 0; right: 0; padding: 1em 0.5em; background: red; font-size: 1.2rem; font-weight: bold; text-align: center; } </style> </head> <body > <div class="ink"> <div class="ripple"> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> </div> <div class="ripple"> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> </div> <div class="ripple"> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> </div> <div class="ripple"> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> </div> <div class="ripple"> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> <svg class="ripple-ridge" viewBox="0 0 100 10"> <path d="M 0 10 C 35 10 35 0 50 0 C 65 0 65 10 100 10"></path> </svg> </div> &l.........完整代码请登录后点击上方下载按钮下载查看
网友评论0