div+css实现多媒体家庭影院效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现多媒体家庭影院效果代码,可实现进度拖拽、视频节目更换等效果,点击电视可切换,拖拽底部可实现进度调整。

代码标签: div css 多媒体 家庭 影院

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
<style>
@import url('https://fonts.cdnfonts.com/css/lcd');
*{
    box-sizing: border-box;
}
html, body {
    height: 100%;
    overflow: hidden;
}
body {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin: 0;
    font-family: 'LCD', sans-serif;
    font-family: 'LCD2', sans-serif;
    font-family: 'LCDMono2', sans-serif;
    font-family: 'LCDMono', sans-serif;
    font-family: 'Digitalism', sans-serif;
    background: #0e0e0e;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    
    --_factor: min(500px, 80vh);
    --_size: min(var(--_factor), 60vw);
    font-size: calc(var(--_size) * 0.01); /*~ allows em units for responsive scaling ~*/
}

#media-container {
    width: fit-content; height: fit-content; 
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    translate: 0 -10em;
    z-index: 2;
}

#media-container video, #media-container img {
    --size: 90em;
    --blur-scale: 1.1;
    --blur-val: 4em;
    width: var(--size);
}
#media-container video:nth-child(1),
#media-container img:nth-child(1) {
    box-shadow: 0 0 0 5px #0e0e0e;
    border-radius: 1px;
    filter: brightness(1);
    cursor: pointer;
    aspect-ratio: 16/9;
    object-fit: cover;
    background-color: black;
    box-shadow: 
    0 -0.1em 0.5em 0em #fff2,
    0 0 0 1.2em #0e0e0e,
    0 -0.1em 0.2em 1.2em #fff2,
    inset 0 0 4em 4em #000,
    inset 1em 2em 12em -1em #fff5;
    transition: box-shadow 0.16s ease-in-out;
}
#media-container video:nth-child(1):hover,
#media-container img:nth-child(1):hover {
    box-shadow: 
    0 -0.1em 0.5em 0em #fff2,
    0 0 0 1.2em #0e0e0e,
    0 -0.1em 0.2em 1.2em #fff2,
    inset 0 0 4em 4em #000,
    inset 1em 6em 12em 1em #fff5;
}
#media-container video:nth-child(2),
#media-container img:nth-child(2) {
    width: calc(var(--size) * var(--blur-scale));
    scale: 1 calc(pow(var(--blur-scale), 0.5));
    z-index: -1;
    position: absolute;
    opacity: 0.8;
    filter: contrast(3) blur(var(--blur-val)); /* 1vw-3vw */
}
#media-container video:nth-child(3),
#media-container img:nth-child(3) {
    object-position: -10% 50%;
    width: 14em;
    height: 40em;
    object-fit: cover;
    scale: 1 calc(pow(var(--blur-scale), 5));
    z-index: -1;
    position: absolute;
    left: 0; right: 0; margin: auto;
    translate: -56em;

    transform: rotateY(180deg);
    opacity: 0.8;
    filter: contrast(3) blur(var(--blur-val)); /* 1vw-3vw */
}
#media-container video:nth-child(4),
#media-container img:nth-child(4) {
    object-position: 110% 50%;
    width: 14em;
    height: 40em;
    object-fit: cover;
    scale: 1 calc(pow(var(--blur-scale), 5));
    z-index: -1;
    position: absolute;
    left: 0; right: 0; margin: auto;
    translate: 56em;

    transform: rotateY(180deg);
    opacity: 0.8;
    filter: contrast(3) blur(var(--blur-val)); /* 1vw-3vw */
}

.floor {
    position: absolute;
    width: 100%;
    height: 100em;
    top: 0;
    bottom: 0;
    margin: auto;
    translate: 0 92em;
}

.floor > div {
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0; margin: auto;
    width: 100%; height: 100%;
}
.floor > div > div {
    position: absolute;
    width: 100%; height: 0.1em;
    background: #0005;
    box-shadow: 0 2px 0 0 #fff1;
}
.floor > div:nth-child(1) { 
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        #272727 0.1deg 0.15deg, 
        #1d1d1d 0.2deg 1.95deg, 
        #000 2deg,
        transparent 2.1deg 2.15deg, 
        transparent 2.2deg 3.95deg, 
        #000 4deg,
        transparent 4.1deg 4.15deg, 
        transparent 4.2deg 5.95deg, 
        #000 6deg
    );
}
.floor > div:nth-child(1) > div {
    top: 12%;
}
.floor > div:nth-child(2) {
    --ct: 0%; --cb: 10%;
    clip-path: polygon(0 var(--ct), 100% var(--ct), 100% var(--cb), 0% var(--cb));
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        #272727 0.1deg 0.15deg, 
        #1d1d1d 0.2deg 1.95deg, 
        #000 2deg,
        transparent 2.1deg 2.15deg, 
        transparent 2.2deg 3.95deg, 
        #000 4deg,
        transparent 4.1deg 4.15deg, 
        transparent 4.2deg 5.95deg, 
        #000 6deg
    );
}
.floor > div:nth-child(3) {
    z-index: -1; 
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        transparent 0.1deg 0.15deg, 
        transparent 0.2deg 1.95deg, 
        #000 2deg,
        #272727 2.1deg 2.15deg, 
        #1d1d1d 2.2deg 3.95deg, 
        #000 4deg,
        #272727 4.1deg 4.15deg, 
        #1d1d1d 4.2deg 5.95deg, 
        #000 6deg
    );
}
.floor > div:nth-child(3) > div {
    top: 6%;
}
.floor > div:nth-child(4) {
    --ct: 10%; --cb: 30%;
    clip-path: polygon(0 var(--ct), 100% var(--ct), 100% var(--cb), 0% var(--cb));
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        transparent 0.1deg 0.15deg, 
        transparent 0.2deg 1.95deg, 
        #000 2deg,
        #272727 2.1deg 2.15deg, 
        #1d1d1d 2.2deg 3.95deg, 
        #000 4deg,
        #272727 4.1deg 4.15deg, 
        #1d1d1d 4.2deg 5.95deg, 
        #000 6deg
    );
}
.floor > div:nth-child(5) {
    z-index: 0; 
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        transparent 0.1deg 0.15deg, 
        transparent 0.2deg 1.95deg, 
        #000 2deg,
        transparent 2.1deg 2.15deg, 
        transparent 2.2deg 3.95deg, 
        #000 4deg,
        #272727 4.1deg 4.15deg, 
        #1d1d1d 4.2deg 5.95deg, 
        #000 6deg
    );
}
.floor > div:nth-child(5) > div {
    top: 23%;
}
.floor > div:nth-child(6) {
    --ct: 16%; --cb: 40%;
    clip-path: polygon(0 var(--ct), 100% var(--ct), 100% var(--cb), 0% var(--cb));
    background: repeating-conic-gradient( 
        from 45deg at 50% -150%, 
        #000 0deg, 
        #272727 0.1deg 0.15deg, 
        #1d1d1d 0.2deg 1.95deg, 
        #000 2deg,
        #272727 2.1deg 2.15deg, 
        #1d1d1d 2.2deg 3.95deg, 
        #000 4deg,
        transparent 4.1deg 4.15deg, 
        transparent 4.2deg 5.95deg, 
        #000 6deg
    );
}


.media-center {
    width: 100%; height: 10em;
    position: absolute; top: 0; bottom: 0; margin: auto;
    translate: 0 38em;
    display: flex;
    background: #101418;
    box-shadow: 0 12px 24px 0 #0006;
}
.media-center::before {
    content: ''; display: block; width: 100%; height: 42%;
    position: absolute; bottom: 104%; 
    background: linear-gradient( 0deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.4));
    box-shadow: 
    0 1px 2px 0 #000, 
    0 -4px 8px -2px rgba(255, 255, 255, 0.7),
    0 -10px 20px rgba(255, 255, 255, 0.2);
}
.media-center > div {
    width: 25%; height: 84%;
    box-shadow: 
    0 4px 4px 0 #000,
    inset -1px -8px 3px -8px #000,
    inset -1px -8px 2px -8px #fff6,
    inset -1px 1px 2px -1px #fff6,
    inset -1px 1px 8px -4px #fff3
    ;
    background: #0e1215;
    border: 1px solid #0e0e0e;
}

.lightbars {
    z-index: 4;
    width: 120em; height: 70em;
    position: absolute; top: 0; bottom: 20em; margin: auto;
    display: flex; justify-content: space-between;
    pointer-events: none;
}
.lightbars .left,
.lightbars .right {
    position: relative;
    width: 2em;
    background: #0e0e0e;
    border-radius: 100px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    height: 100%;
    box-shadow: 
    inset 0.6em 0.3em 1.2em 0 #fff1,
    inset 0.2em 0.2em 0.3em 0 #fff1,
    inset 0.2em 0.3em 0.3em 0 #fff1;
}
.lightbars .left {
    box-shadow: 
    inset -0.6em 0.3em 1.2em 0 #fff1,
    inset -0.2em 0.2em 0.3em 0 #fff1,
    inset -0.2em 0.3em 0.3em 0 #fff1;
}
.lightbars > div::before,
.lightbars > div::after{
    z-index: -1;
}
.lightbars > div::before{
    content: ''; display: block;
    width: 200%; height: 7em;
    position: absolute; top: 99%;
    border-radius: 40% / 5%;
    background: #0e0e0e;
    b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0