js+css实现屋子中的电视闹鬼动画代码
代码语言:html
所属分类:其他
代码描述:js+css实现屋子中的电视闹鬼动画代码,看着电视,突然出现女鬼在眼前,晚上不要看,有心脏病的也不要看,有点恐怖。6秒钟后会出现。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
:root {
--title: "'The Ring' Movie Tribute";
--author: "Matt Cannon";
--contact: "mc@mattcannon.design";
--description: "A tribute to one of the scariest movies ever made, enhanced with a chilling, possibly humorous glitch effect. The Ring is a horror classic, making it the perfect fit for spooky season.";
--keywords: "codepenchallenge, cpc-halloween-movies, halloween, horror, glitch, the-ring, spooky, movie-tribute, glitch-effect";
--last-modified: "2024-10-21";
--content-language: "en";
--generator: "HTML5, CSS3, JavaScript";
}
.gradient {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: linear-gradient(
to left,
rgba(0, 0, 0, 0.6) 0%,
transparent 20%,
transparent 80%,
rgba(0, 0, 0, 0.6) 100%
),
radial-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.2));
z-index: 5;
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
.gradient::before, .gradient::after {
position: fixed;
width: 100vw;
height: 100vh;
content: " ";
box-sizing: border-box;
}
.brick-wall {
position: fixed;
content: " ";
top: 0;
left: 0;
right: 0;
bottom: 140px;
background: url(//repo.bfw.wiki/bfwrepo/image/671b19689e40c.png);
background-size: 400px;
box-shadow: 0 8px 10px rgba(0, 0, 0, 0.8);
z-index: 2;
}
.wood-floor {
position: fixed;
content: " ";
width: 100%;
height: 140px;
bottom: 0;
left: 0;
-ms-perspective: 300px;
-webkit-perspective: 300px;
perspective: 300px;
overflow: hidden;
z-index: 1;
}
.wood-floor::before {
position: absolute;
content: " ";
top: -100%;
left: -25%;
width: 150%;
height: 250%;
background: url(//repo.bfw.wiki/bfwrepo/image/671b1883da0be.png);
background-size: 400px;
-webkit-transform: rotateX(60deg);
transform: rotateX(60deg);
}
html > body .old-tv * {
outline: none;
}
.old-tv {
position: absolute;
width: 870px;
height: 465px;
bottom: 160px;
left: 50%;
margin-left: -455px;
background: #333;
padding: 20px;
border-radius: 8px;
border-bottom: 4px #222 solid;
box-shadow: inset 0 -220px 200px rgba(0, 0, 0, 0.5),
50px 2px 20px rgba(0, 0, 0, 0.4), -50px 2px 20px rgba(0, 0, 0, 0.4);
-webkit-transform: scale(0.4);
transform: scale(0.4);
z-index: 600;
}
.old-tv::after {
content: " ";
position: absolute;
top: 54px;
left: 52px;
width: 600px;
height: 400px;
background: rgba(255, 255, 255, 0.4);
border-radius: 5% / 50%;
-webkit-filter: blur(30px);
filter: blur(30px);
z-index: 100;
-webkit-animation: screen 800ms infinite linear;
animation: screen 800ms infinite linear;
}
@-webkit-keyframes screen {
0% {
-webkit-transform: scale(1.03);
transform: scale(1.03);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(1.03);
transform: scale(1.03);
}
}
@keyframes screen {
0% {
-webkit-transform: scale(1.03);
transform: scale(1.03);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(1.03);
transform: scale(1.03);
}
}
.old-tv .antenna {
position: absolute;
width: 200px;
height: 20px;
background: #222;
top: -20px;
left: 240px;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
box-shadow: inset 0 5px #444, inset 0 -2px 5px #000;
}
.old-tv .antenna:before {
content: " ";
position: absolute;
bottom: 8px;
left: 40px;
width: 12px;
height: 250px;
background-color: #444;
background-image: -webkit-linear-gradient(
rgba(255, 255, 255, 0.1),
transparent
);
background-image: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
-webkit-transform: rotate(-20deg);
transform: rotate(-20deg);
border-top-left-radius: 40%;
border-top-right-radius: 40%;
box-shadow: inset -1px 1px rgba(255, 255, 255, 0.4),
inset 5px 0 5px rgba(0, 0, 0, 0.5), -8px 5px 15px rgba(0, 0, 0, 0.5);
z-index: -1;
}
.old-tv .antenna:after {
content: " ";
position: absolute;
bottom: 8px;
left: 150px;
width: 12px;
height: 250px;
background: #444;
background-image: -webkit-linear-gradient(
rgba(255, 255, 255, 0.1),
transparent
);
background-image: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
-webkit-transform: rotate(20deg);
transform: rotate(20deg);
border-top-left-radius: 40%;
border-top-right-radius: 40%;
box-shadow: inset -1px 1px rgba(255, 255, 255, 0.4),
inset 5px 0 5px rgba(0, 0, 0, 0.5), -10px 5px 15px rgba(0, 0, 0, 0.5);
z-index: -1;
}
.old-tv main {
position: relative;
display: inline-block;
padding: 30px;
border-radius: 8px;
background: #444;
border: 3px #aaa solid;
box-shadow: 0 10px 8px rgba(0, 0, 0, 0.4);
vertical-align: top;
}
.old-tv main::before {
content: " ";
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
width: 100%;
height: 100%;
border-radius: 8px;
border-style: solid;
border-width: 80px 90px 77px 90px;
border-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.2) transparent
rgba(0, 0, 0, 0.2);
z-index: 1;
}
.old-tv main::after {
content: " ";
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
width: 100%;
height: 100%;
background: -webkit-radial-gradient(
rgba(0, 0, 0, 0.7) 50%,
rgba(0, 0, 0, 0) 100%
),
-webkit-linear-gradient(rgba(0, 0, 0, 0.1) 10%, transparent);
background: radial-gradient(rgba(0, 0, 0, 0.7) 50%, rgba(0, 0, 0, 0) 100%),
linear-gradient(rgba(0, 0, 0, 0.1) 10%, transparent);
z-index: 2;
}
.old-tv .speaker {
position: absolute;
width: 200px;
height: 260px;
top: 20px;
right: 20px;
padding: 10px;
box-sizing: border-box;
}
.old-tv .speaker::before {
content: " ";
position: absolute;
top: 0%;
left: 15px;
right: 0%;
bottom: 0%;
background: -webkit-repeating-linear-gradient(
90deg,
rgba(255, 255, 255, 0.1) 0px,
rgba(0, 0, 0, 0.2) 5px,
rgba(0, 0, 0, 0.2) 6px,
transparent 5px,
rgba(0, 0, 0, 0.6) 10px
);
background: repeating-linear-gradient(
0deg,
rgba(255, 255, 255, 0.1) 0px,
rgba(0, 0, 0, 0.2) 5px,
rgba(0, 0, 0, 0.2) 6px,
transparent 5px,
rgba(0, 0, 0, 0.6) 10px
);
border-radius: 20px;
border: 2px #111 solid;
box-shadow: 0 1px 3px rgba(255, 255, 255, 0.5),
0 4px 15px rgba(0, 0, 0, 0.6);
z-index: 2;
}
.old-tv .speaker::after {
content: " ";
position: absolute;
height: 200px;
left: 50px;
right: 38px;
bottom: 30px;
background: #222;
border-radius: 100% / 100%;
box-shadow: inset 0 1px black;
opacity: 0.1;
z-index: 1;
}
.old-tv .volume {
position: absolute;
width: 180px;
height: 40px;
right: 20px;
bottom: 145px;
border-radius: 4px;
box-shadow: inset 2px 2px rgba(255, 255, 255, 0.1),
inset -2px -2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.2),
0 4px 10px rgba(0, 0, 0, 0.4);
border: 2px #000 solid;
}
.old-tv .channel {
position: absolute;
width: 180px;
height: 40px;
right: 20px;
bottom: 90px;
border-radius: 4px;
box-shadow: inset 2px 2px rgba(255, 255, 255, 0.1),
inset -2px -2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.2),
0 4px 10px rgba(0, 0, 0, 0.4);
border: 2px #000 solid;
}
.old-tv input[type="range"] {
-webkit-appearance: none;
position: absolute;
width: 80%;
left: 10%;
box-sizing: border-box;
background: none;
margin: 18px 0;
}
.old-tv input[type="range"]:focus {
outline: none;
}
.old-tv input[type="range"]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.2);
background: #000;
border-radius: 1.3px;
}
.old-tv input[type="range"]::-webkit-slider-thumb {
height: 25px;
width: 10px;
border-radius: 2px;
background-color: #444;
background-image: -webkit-linear-gradient(
rgba(255, 255, 255, 0.1),
transparent
);
background-image: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
box-shadow: inset 1px 1px 1px rgba(255, 255, 255, 0.2), 1px 1px 6px black;
cursor: pointer;
-webkit-appearance: none;
margin-top: -10px;
}
.old-tv .power {
position: absolute;
width: 180px;
height: 60px;
right: 20px;
bottom: 15px;
border-radius: 4px;
box-shadow: inset 2px 2px rgba(255, 255, 255, 0.1),
inset -2px -2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.2),
0 4px 10px rgba(0, 0, 0, 0.4);
border: 2px #000 solid;
}
.old-tv .power > button {
position: relative;
width: 70px;
height: 40px;
top: 10px;
left: 10px;
background-color: #333;
background-image: -webkit-linear-gradient(
rgba(255, 255, 255, 0.05),
transparent
);
background-image: linear-gradient(rgba(255, 255, 255, 0.05), transparent);
border-radius: 4px;
box-shadow: inset 1px 1px rgba(255, 255, 255, 0.1),
inset 1px 1px rgba(255, 255, 255, 0.1),
inset -1px -1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.2);
border: 2px #000 solid;
cursor: pointer;
}
.old-tv .power::after {
content: " Power ";
position: absolute;
font-family: Arial;
font-size: 10px;
color: #ccc;
width: 5px;
height: 5px;
top: 18px;
left: 100px;
bottom: 30px;
background: #7cfc00;
box-shadow: 0 0 10px #7cfc00, 0 0 5px #7cfc00;
border: 1px #7cfc00 solid;
border-radius: 50%;
line-height: 5px;
text-indent: 12px;
text-shadow: 0 1px #000;
}
.old-tv .power::before {
content: " Standby ";
position: absolute;
font-family: Arial;
font-size: 10px;
color: #ccc;
width: 5px;
height: 5px;
top: 38px;
left: 100px;
bottom: 30px;
background: #a52a2a;
border: 1px #111 solid;
border-radius: 50%;
line-height: 5px;
text-indent: 12px;
text-shadow: 0 1px #000;
}
.old-tv footer {
position: absolute;
height: 15px;
bottom: -22px;
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0