react+gsap+Draggable实现拖动撕开贴纸显示背部文字效果代码
代码语言:html
所属分类:拖放
代码描述:react+gsap+Draggable实现拖动撕开贴纸显示背部文字效果代码
代码标签: react gsap Draggable 拖动 撕开 贴纸 显示 背部 文字 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/normalize.5.0.css"> <style> *, *:after, *:before { box-sizing: border-box; } :root { --bg: hsl(0 0% 98%); } body { display: grid; place-items: center; min-height: 100vh; font-family: "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue", Helvetica, Arial, sans-serif, system-ui; overflow: hidden; background: var(--bg); } section { height: 100vh; display: grid; place-items: center; position: fixed; inset: 0; } .tear-strip:focus-within { outline: 10px solid hsl(0 0% 0% / 0.15); } .strip-adder { position: fixed; top: 2rem; right: 2rem; width: 48px; aspect-ratio: 1; z-index: 22; border-radius: 50%; border: 0; display: grid; place-items: center; padding: 0; background: hsl(0 0% 90% / var(--alpha, 0)); transition: background 0.2s; } .strip-adder svg { width: 65%; color: hsl(0 0% 10% / var(--alpha, 0.5)); transition: color 0.2s; } .strip-adder:is(:hover, :focus-visible) { --alpha: 1; } .reference { opacity: 1; position: fixed; top: 50%; left: 50%; translate: -50% -150%; } .tear-strip { font-size: 1.3rem; font-weight: bold; width: clamp(300px, 470px, 28vw); width: 340px; height: 78px; display: grid; place-items: center; /* translate: 0 -80%;*/ position: relative; border: 4px dashed hsl(0 0% 91%); border-radius: 100px; background: linear-gradient(hsl(0 0% 91%), hsl(0 0% 91%)) padding-box; color: hsl(0, 0%, 70%); } .tear-strip__content { position: absolute; font-size: 1rem; text-align: right; } .tear-strip__strip { position: absolute; inset: 0; background: var(--bg); display: flex; border-radius: 100px; align-items: center; justify-content: center; -webkit-clip-path: inset(-100% 0 -100% 1px); clip-path: inset(-100% 0 -100% 1px); color: hsl(0, 0%, 71%); font-weight: 500; } .tear-strip__shadow { position: absolute; height: 100%; width: 20px; background: linear-gradient(90deg, transparent, hsl(0 0% 10% / 0.5)); filter: blur(8px); transform-origin: 100% 50%; left: 0; opacity: 0; } .tear-strip__back { position: absolute; height: 100%; width: 100%; border-radius: 100px; right: 100%; } .tear-strip__backing { background: linear-gradient(90deg, hsl(0 0% calc(var(--tab-darkness, 40) * 1%) / var(--bg-alpha, 1)), hsl(0 0% 100% / var(--bg-alpha, 1)), hsl(0 0% 80% / var(--bg-alpha, 1))); background-position: 100% 50%; background-repeat: no-repeat; background-color: hsl(0 0% 93%); background-size: calc(var(--bg-size, 0) * 1px) 100%; position: absolute; inset: 0; border-radius: 1000px; } .tear-strip__backing::before { content: ""; position: absolute; inset: 0 -8px 0 0; filter: blur(4px); background: radial-gradient(hsl(0 0% 10% / 0.5), transparent 80%); border-radius: 1000px; z-index: -1; opacity: var(--shadow-reveal, 0); } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0