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; left: 15px; right: 15px; background: #222; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; box-shadow: inset 0 5px 5px rgba(0, 0, 0, 0.8), 0 10px 25px rgba(0, 0, 0, 0.3); border-bottom: 3px #000 solid; z-index: -1; } .error-noise { position: relative; width: 600px; height: 400px; overflow: hidden; border-radius: 5% / 50%; z-index: 3; } .error-effect { position: absolute; width: 100%; height: 100%; border-radius: 50% / 5%; background: #111; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEB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SmuOlokqw49pgomjLeh7icHNlG19yjs6XXOMedYm5xH2YxpV2tc0Ro2jJfxC50ApuxGob7lMsxfTbeUv07TyYxpeLucEH1gNd4IKH2LAg5TdVhlCafZvpskfncCfx8pOhJzd76bJWeYFnFciwcYfubRc12Ip/ppIhA1/mSZ/RxjFDrJC5xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==); background-size: 80%; -webkit-animation: noise 200ms infinite linear; animation: noise 200ms infinite linear; } .error-effect::before { content: " "; position: absolute; width: 100%; height: 20%; background: rgba(255, 255, 255, 0.2); -webkit-animation: noiseeffect 4000ms infinite linear; animation: noiseeffect 4000ms infinite linear; border-radius: 50% / 5%; } .error-effect::after { content: " "; position: absolute; width: 100%; height: 100%; background: -webkit-radial-gradient( rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.8) ), -webkit-linear-gradient(rgba(255, 255, 255, 0.4) 10%, transparent); background: radial-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.8)), linear-gradient(rgba(255, 255, 255, 0.4) 10%, transparent); box-shadow: inset 0 5px 25px rgba(255, 255, 255, 0.2), inset 5px 0 15px rgba(255, 255, 255, 0.2), inset -5px 0 15px rgba(255, 255, 255, 0.1), 0 0 10px black, inset 0 200px 5px rgba(255, 255, 255, 0.05); border-radius: 50% / 5%; } .old-tv-content { position: absolute; width: 150%; /* Zoom in by increasing the width and height */ height: 150%; top: -20%; /* Move the video upwards to hide the YouTube title */ left: -25%; /* Center the video horizontally */ border-radius: 5% / 50%; border: none; /* Remove iframe borders */ z-index: 5; opacity: 1; /* Ensure visibility */ } .old-tv-content::after { content: " "; position: absolute; width: 100%; height: 100%; background: -webkit-repeating-linear-gradient( 0, #fff, #fff 2px, transparent 4px ); background: repeating-linear-gradient(0, #fff, #fff 2px, transparent 4px); opacity: 0.2; border-radius: 50% / 5%; -webkit-animation: crt-pixels 20ms alternate infinite; animation: crt-pixels 20ms alternate infinite; } @-webkit-keyframes crt-image { 0% { -webkit-transform: translateY(-1px); transform: translateY(-1px); } 100% { -webkit-transform: translateY(0px); transform: translateY(0px); } } @keyframes crt-image { 0% { -webkit-transform: translateY(-1px); transform: translateY(-1px); } 100% { -webkit-transform: translateY(0px); transform: translateY(0px); } } @-webkit-keyframes crt-pixels { 0% { -webkit-transform: translateY(-3px); transform: translateY(-3px); } 100% { -webkit-transform: translateY(0px); transform: translateY(0px); } } @keyframes crt-pixels { 0% { -webkit-transform: translateY(-3px); transform: translateY(-3px); } 100% { -webkit-transform: translateY(0px); transform: translateY(0px); } } @-webkit-keyframes noise { 0% { background-position: 0px 1000px; } 50% { background-position: -.........完整代码请登录后点击上方下载按钮下载查看
网友评论0