css+svg实现磨砂透明层渐变弹出动画效果代码
代码语言:html
所属分类:弹出层
代码描述:css+svg实现磨砂透明层渐变弹出动画效果代码
代码标签: css svg 磨砂 透明 层 渐变 弹出 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background: #161616;
}
* {
margin: 0;
padding: 0;
-ms-overflow-style: none;
scrollbar-width: none;
text-rendering: geometricPrecision;
box-sizing: border-box;
}
*::-webkit-scrollbar {
display: none;
}
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900;1,100..900&display=swap');
:root {
--side-panel: 200px;
}
h1, p {
font-family: "Hanken Grotesk", sans-serif;
font-optical-sizing: auto;
font-style: normal;
color: #fff;
}
h1 {
font-size: 40px;
font-weight: 400;
letter-spacing: -0.05em;
}
p {
font-size: 16px;
letter-spacing: 0em;
line-height: 140%;
}
p.bold {
font-weight: 400;
color: rgba(255,255,255,0.65);
}
p.light {
font-weight: 400;
color: rgba(255,255,255,0.45);
}
main {
position: relative;
width: 100%;
height: 100vh;
padding: 32px;
display: flex;
align-items: stretch;
overflow: hidden;
}
.content-wrapper {
display: flex;
align-items: center;
justify-content: center;
flex: 1 1 0%;
}
.content {
position: relative;
width: 100%;
max-width: 800px;
height: 100%;
min-height: 500px;
background: #161616;
box-shadow: inset 0 0 150px rgba(52,46,45,1);
display: flex;
align-items: start;
justify-content: start;
gap: 16px;
transform: translate3d(0,0,0);
border-radius: 50px;
border: 2px solid #232120;
-webkit-border-radius: 50px;
will-change: box-shadow;
-webkit-will-change: box-shadow;
transition: 1s cubic-bezier(.17,1,.33,1);
}
.content.active {
box-shadow: inset 0 0 150px rgba(52,46,45,0.7);
background: #0F0F0F;
}
.main-content {
position: relative;
width: 100%;
height: 100%;
border-radius: 48px;
-webkit-border-radius: 48px;
overflow: hidden;
transform: translate3d(0,0,0) scale(1);
filter: blur(0px) brightness(1);
will-change: transform, filter;
-webkit-will-change: transform, filter;
transition: 0.6s cubic-bezier(.17,1,.33,1);
}
.content.active .main-content {
transform: translate3d(0,0,0) scale(0.9);
filter: blur(16px) brightness(0.7);
transition: 0.3s ease-out;
}
.photo-wrapper {
position: relative;
height: 50%;
width: 100%;
max-height: 400px;
}
.photo {
position: absolute;
z-index: 1;
top: 0;
left: 0;
height: 100%;
width: 100%;
object-fit: contain;
background: #161616;
border-radius: 44px;
}
.main-info {
position: relative;
width: 100%;
z-index: 1;
display: flex;
flex-flow: column;
gap: 32px;
padding: 32px;
}
.title-container {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
}
.title-info {
display: flex;
gap: 12px;
padding-right: 4px;
}
@media screen and (max-width: 600px) {
.title-info {
display: none;
}
}
.songs {
display: flex;
flex-direction: column;
justify-content: stretch;
gap: 6px;
}
.song {
display: flex;
align-items: center;
justify-content: space-between;
min-width: 100%;
min-height: 72px;
border-radius: 32px;
border: 2px solid rgba(255,255,255,0.04);
padding: 0 22px;
margin: 0 -22px;
box-shadow: inset 0 0 0px 0 rgba(255,255,255,0.15);
transition: .2s ease;
cursor: pointer;
}
.songs .song:hover {
box-shadow: inset 0 0 64px 0 rgba(255,255,255,0.075);
}
.end {
display: flex;
align-items: center;
gap: 24px;
}
.song svg {
opacity: 0;
transition: 0.2s ease;
}
.songs .song:hover svg {
opacity: 0.5;
}
.song svg:hover {
opacity: 1!important;
cursor: pointer;
}
/* progressive blur stuffs */
.gradient-blur {
position: absolute;
top: 0!important;
left: 0!important;
width: 100%;
height: 101%;
inset: auto 0 0 0;
pointer-events: none;
overflow: hidden;
z-index: 2;
}
.song-modal .gradient-blur {
height: 800px;
top: auto!important;
bottom: 0;
}
.gradient-blur > div {
position: absolute;
inset: 0;
transition: 0.4s ease-out;
}
.content.active .gradient-blur > div {
backdrop-filter: blur(0px);
-webkit-backdrop-filter: blur(0px);
transition: 0.5s ease-out 0.3s;
}
.gradient-blur > div:nth-of-type(1) {
z-index: 1;
backdrop-filter: blur(0.5px);
-webkit-backdrop-filter: blur(0.5px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 21%, rgba(0, 0, 0, 1) 29%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 21%, rgba(0, 0, 0, 1) 29%);
}
.gradient-blur > div:nth-of-type(2) {
z-index: 2;
backdrop-filter: blur(1px);
-webkit-backdrop-filter: blur(1px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 29%, rgba(0, 0, 0, 1) 37%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 29%, rgba(0, 0, 0, 1) 37%);
}
.gradient-blur > div:nth-of-type(3) {
z-index: 3;
backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(3px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 37%, rgba(0, 0, 0, 1) 45%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 37%, rgba(0, 0, 0, 1) 45%);
}
.gradient-blur > div:nth-of-type(4) {
z-index: 4;
backdrop-filter: blur(7px);
-webkit-backdrop-filter: blur(7px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 1) 53%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 1) 53%);
}
.gradient-blur > div:nth-of-type(5) {
z-index: 5;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 53%, rgba(0, 0, 0, 1) 61%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 53%, rgba(0, 0, 0, 1) 61%);
}
.gradient-blur > div:nth-of-type(6) {
z-index: 6;
backdrop-filter: blur(32px);
-webkit-backdrop-filter: blur(32px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 61%, rgba(0, 0, 0, 1) 73%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 61%, rgba(0, 0, 0, 1) 69%);
}
.gradient-blur > div:nth-of-type(7) {
z-index: 7;
backdrop-filter: blur(64px);
-webkit-backdrop-filter: blur(64px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 69%, rgba(0, 0, 0, 1) 77%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 69%, rgba(0, 0, 0, 1) 77%);
}
.gradient-blur > div:nth-of-type(8) {
z-index: 8;
backdrop-filter: blur(128px);
-webkit-backdrop-filter: blur(128px);
mask: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 77%, rgba(0, 0, 0, 1) 85%);
-webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 77%, rgba(0, 0, 0, 1) 85%);
}
/* modals */
.modal, .song-modal {
position: absolute;
z-index: 99;
top: 0;
left: 0;
background: #272322;
width: 96px;
height: 96px;
display: flex;
align-items: start;
justify-content: start;
border-radius: 48px;
-webkit-border-radius: 48px;
transform: translateZ(0);
overflow: hidden;
will-change: width, height;
-webkit-will-change: width, height;
cursor: pointer;
transition: 0.6s cubic-bezier(.17,1,.33,1);
}
.modal.active {
width: 500px;
height: 500px;
transition: 1s cubic-bezier(.17,1,.33,1);
cursor: auto;
}
.toggle {
position: absolute;
z-index: 5;
top: 8px;
left: 8px;
width: 80px;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255,255,255,0);
backdrop-filter: blur(0px);
opacity: 1;
cursor: pointer;
transition: 0.2s all;
}
.modal.active .toggle {
background: rgba(255,255,255,0.05);
backdrop-filter: blur(24px);
}
.modal.active .toggle:hover {
background: rgba(255,255,255,0.1);
}
.toggle svg {
transform: rotateZ(0deg);
transition: 1s cubic-bezier(.32,1.35,.75,1);
}
.modal.active .toggle svg {
transform: rotateZ(135deg);
}
.modal-content {
position: relative;
min-width: 500px;
height: 500px;
display: flex;
flex-flow: column;
padding: 4px;
transform: scale(0.8);
transform-origin: top left;
transition: transform 1s cubic-bezier(.16,.61,.23,1);
}
.modal.active ..........完整代码请登录后点击上方下载按钮下载查看
网友评论0