gsap实现Vista风格ui卡片面板滚动设计代码
代码语言:html
所属分类:布局界面
代码描述:gsap实现Vista风格ui卡片面板滚动设计代码,结合了ScrollSmoother、MorphSVGPlugin3、ScrollTrigger插件一起实现。
代码标签: gsap Vista 风格 ui 卡片 面板 滚动 设计 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { overflow: hidden; } body { margin: 0; font-family: sans-serif; --color-gray: #aaa; --color-purple: #3E3753; --ease: cubic-bezier(.44,0,.63,1); background-image: url(//repo.bfw.wiki/bfwrepo/image/63dca8896f791.png); background-size: cover; background-attachment: fixed; } #smooth-wrapper { position: relative; max-width: 500px; height: 100%; width: 100%; margin: auto; overflow: auto; border-radius: 35px; box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.5); } #smooth-content { overflow-y: hidden !important; } .hero { position: relative; height: 40vh; min-height: 300px; color: white; display: flex; } .hero .hero-circle { width: 25px; height: 25px; background: #D7DCEB; border-radius: 50%; margin-left: 1rem; margin-top: 0.5rem; } .hero .hero-btn { overflow: visible; width: 50px; } .hero .hero-btn .hero-btn-circle { cursor: pointer; transform-origin: center center; transition: transform 0.4s var(--ease); } .hero .hero-btn:hover .hero-btn-circle { transform: scale(1.1); } h1 { font-size: 0.7rem; font-weight: 100; margin: 1rem 0; text-transform: uppercase; } .hero-bg { position: absolute; height: 200%; width: 100%; background-size: auto 50%; background-repeat: no-repeat; background-position: left top; } .hero-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .hero-top { display: flex; justify-content: space-between; width: 100%; padding: 2em 1em; box-sizing: border-box; } .wave { position: absolute; bottom: -1px; left: 0; width: 100%; height: 50px; } .hidden-wave { display: none; } .gradient { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: linear-gradient(90deg, #9398c4, rgba(147, 152, 196, 0.5) 100px, rgba(147, 152, 196, 0) 200px); mix-blend-mode: multiply; opacity: 0.8; z-index: 100; pointer-events: none; } .content { background: white; position: relative; color: var(--color-purple); } .content-inner { padding: 2em; max-width: 800px; margin: auto; } .label { position: absolute; top: -10px; display: flex; color: var(--color-gray); align-items: center; } .label-icon { border-radius: 50%; width: 30px; height: 30px; background: #c97984; } .label-text { font-size: 10px; text-transform: uppercase; line-height: 0.5em; height: 1em; border: 1px solid var(--color-gray); padding: 0.3rem 0.8rem; margin-left: 1em; border-radius: 20px; vertical-align: middle; display: flex; justify-content: center; align-items: center; } .title { margin: 2em 0; display: flex; justify-content: space-between; font-size: 1.5rem; font-weight: 400; text-transform: capitalize; } .price { display: flex; align-items: center; } .price::after { margin-left: 0.2em; content: ""; display: block; width: 0.8em; height: 0.8em; border-radius: 50%; border: 2px solid currentColor; } .grid-container { margin: 3em 0; text-align: center; font-size: 0.8rem; color: #B5B5B8; } .grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-gap: 1em; margin: 1em 0; } .grid.bold { font-weight: 800; } .line { width: 100%; height: 2px; background: var(--color-gray); margin: 1em 0; } .line.no-margin { margin: 0; } .line.lighter { opacity: 0.25; } .pill { display: inline-block; padding: 0.5em 1em; border-radius: 20px; background: var(--color-gray); color: white; height: 1.5em; width: 2.5em; margin: auto; align-self: center; font-size: 10px; text-transform: uppercase; transition: filter 0.2s var(--ease); } .pill:nth-child(1) { background: #C97984; } .pill:nth-child(2) { background: #A789F7; } .pill:nth-child(3) { background: #FDBA7F; } .pill:nth-child(4) { background: #FEA1C0; } .pill:nth-child(5) { background: #BF50FF; } .pill:hover { filter: saturate(2); } .img-grid { display: grid; font-size: 0.8rem; grid-gap: 0.5em; padding-right: 1.5em; box-sizing: border-box; width: 100%; grid-template-columns: 100px 1fr 1fr 1fr; grid-template-rows: auto; grid-template-areas: "img header . price" "img subhead subhead ." "img contenta contentb contentc" "img contentd contente contentf"; } .img-grid img { grid-area: img; } .img-grid .img-grid-header { grid-area: header; } .img-grid .img-grid-price { grid-area: price; text-align: right; } .img-grid .img-grid-subhead { grid-area: subhead; } .img-grid .img-grid-contenta { grid-area: contenta; } .img-grid .img-grid-contentb { grid-area: contentb; } .img-grid .img-grid-contentc { grid-area: contentc; } .img-grid .img-grid-contentd { grid-area: contentd; } .img-grid .img-grid-contente { grid-area: contente; } .img-grid .img-grid-contentf { grid-area: contentf; } .img-grid .gray { color: var(--color-gray); font-size: 0.7rem; } .img-grid .center { text-align: center; } .img-grid .right { text-align: right; } .button-section { display: flex; justify-content: space-between; align-items: flex-start; margin: 2em 0; font-size: 0.8rem; height: 50px; } .button-section .button-section-text { flex: 1; display: flex; flex-direction: column; margin-right: 1rem; justify-content: space-between; height: 100%; } .button-section .button-section-text-copy { flex: 1; } .button-holder { position: relative; } .button-shadow { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0.3; border-radius: 15px; filter: blur(20px); transform: translate(10px, 10px); } .button { background-color: #9972f5; background: linear-gradient(-45deg, #7456ce, #9871F9); color: white; border: none; font-size: 12px; border-radius: 15px; padding: 1rem 2.2rem; cursor: pointer; position: relative; transform: scale(1); transition: background-color 0.4s var(--ease), transform 0.4s var(--ease); } .button:hover { transform: scale(1.05); background-color: #7e5ae5; } nav { display: flex; justify-content: space-between; padding: 1.5rem 0.5rem 1rem; } a-nav-item { display: flex; flex-direction: column; } #link { bottom: 0; left: 0; position: fixed; z-index: 1000; background: rgba(255, 255, 255, 0.8); padding: 0.5rem 1rem; margin: 1rem 0; } #link a { text-decoration: none; color: #333; cursor: pointer; } #link a:hover { color: #d0656f; cursor: pointer; text-decoration: none; } #link .ai-link { display: flex; align-items: center; margin: 1rem 0; } #link .ai-link svg { margin-right: 0.5em; } #linkText { font-size: 1.5em; } @media screen and (max-width: 600px) { #smooth-wrapper { transform-origin: center center; transform: scale(0.5); } } @media screen and (max-height: 600px) { #smooth-wrapper { height: 150% !important; transform-origin: center center; transform: scale(0.5); } } </style> </head> <body > <div id="wrapper"> <div id="smooth-wrapper"> <div id="smooth-content"> <section class="hero"> <div class="hero-bg" data-lag="0.1" style="background-image: url('//repo.bfw.wiki/bfwrepo/image/63dca89981e5b.png');"></div> <div class="hero-content"> <div class="hero-top" data-lag="0.3"> <div class="hero-circle"></div> <h1>travel hub</h1> <svg id="Layer_3" class="hero-btn" data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 43.01 49.02"> <defs> <style> .cls-2 { fill: url(#radial-gradient-3); } .cls-3 { fill: url(#radial-gradient-2); } .cls-4 { fill: url(#radial-gradient); } </style> <radialGradient id="radial-gradient" cx="-6.67" cy="-15.77" fx="-6.67" fy="-15.77" r="21.38" gradientTransform="translate(7.36 33.47) rotate(90) scale(1.17 .9)" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#605988"/> <stop offset="1" stop-color="#605988" stop-opacity="0"/> </radialGradient> <radialGradient id="radial-gradient-2" cx="22.78" cy="27.71" fx="22.78" fy="27.71" r="18.8" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#d6d0d1"/> <stop offset=".4" stop-color="#dacfd0"/> <stop offset="1" stop-color="#f9f9f9"/> </radialGradient> <radialGradient id="radial-gradient-3" cx="19.9" cy="18.51" fx="19.9" fy="18.51" r="16.54" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#f8f8f8"/> <stop offset="1" stop-color="#f7f7f7" stop-opacity="0&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0