.spooky-container { display: block; position: fixed; overflow: hidden; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; } .spooky { position: fixed; top: 0; will-change: transform; translate: 0 120vh; z-index: 15; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-select: none; cursor: default; -webkit-animation-name: spooky-float; -webkit-animation-duration: 10s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-play-state: running; animation-name: spooky-float; animation-duration: 10s; animation-timing-function: linear; animation-iteration-count: infinite; animation-play-state: running; } .spooky-inner { width: 30px; height: auto; will-change: transform; -webkit-animation-name: spooky-shake; -webkit-animation-duration: 3s; -webkit-animation-timing-function: ease-in-out; -webkit-animation-iteration-count: infinite; -webkit-animation-play-state: running; animation-name: spooky-shake; animation-duration: 3s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-play-state: running; } .spooky-inner img { height: auto; width: 100%; } @-webkit-keyframes spooky-float { 0% { translate: 0 120vh; opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } 100% { translate: 0 -150px; opacity: 0; } } @keyframes spooky-float { 0% { translate: 0 120vh; opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } 100% { translate: 0 -150px; opacity: 0; } } @-webkit-keyframes spooky-shake { 0%, 100% { transform: translateX(0) scale(1) rotate(15deg); } 50% { transform: translateX(80px) scale(1.2) rotate(-15deg); } } @keyframes spooky-shake { 0%, 100% { transform: translateX(0) scale(1) rotate(15deg); } 50% { transform: translateX(80px) scale(1.2) rotate(-15deg); } } /* Base predefined starting offsets (if not overridden by js) */ .spooky:nth-of-type(0) { left: 1%; } .spooky:nth-of-type(1) { left: 10%; } .spooky:nth-of-type(2) { left: 20%; } .spooky:nth-of-type(3) { left: 30%; } .spooky:nth-of-type(4) { left: 40%; } .spooky:nth-of-type(5) { left: 50%; } .spooky:nth-of-type(6) { left: 60%; } .spooky:nth-of-type(7) { left: 70%; } .spooky:nth-of-type(8) { left: 80%; } .spooky:nth-of-type(9) { left: 90%; } .spooky:nth-of-type(10) { left: 25%; } .spooky:nth-of-type(11) { left: 65%; }