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;
}
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0