
DVD Bounce Thing
A DVD Bouncer thing. Because funny.
Marquees
CSS Animations
📀
DVD bouncers are very important to society. Here's a tool to make them.
Marquee Hack
You can actually just do a marquee and cheat a little with some styles.
<marquee behavior="alternate" direction="up" class="outer"> <marquee behavior="alternate" direction="right" class="inner">📀</marquee></marquee>
<style> :root { /* Your values here */ --width: 9.2rem; --height: 8rem; } .outer { display: block; width: var(--width); height: var(--height); border: 0.0625rem solid #bcbec0; } .inner { display: block; }</style>
CSS Animations
Or you can do it with animations, though you'll have to have more style boilerplate
<div class="outer"> <div class="inner">📀</div></div>
<style> :root { /* Your values here */ --width: 9.2rem; --height: 8rem; --aspect-ratio: 9.2 / 8; --speed: 3.35s; } .outer { position: relative; display: block; width: var(--width); height: var(--height); border: 0.0625rem solid #bcbec0; } .inner { position: absolute; display: block; animation: bounce-up var(--speed) linear infinite, bounce-right calc(var(--speed) * 9.2 / 8) linear infinite; }
@keyframes bounce-right { 0%, 100% { left: 0; } 50% { left: calc(100% - 1rem); } }
@keyframes bounce-up { 0%, 100% { bottom: 0; } 50% { bottom: calc(100% - 1rem); } }</style>
Potential Issues
-
The
<marquee>
element isn't supported on Safari. If you wanted those users to see it, you will have to use the CSS solution. -
The CSS animations uses a
calc
function that assumes a width of 1rem. This doesn't work if your styles are otherwise.
Additional Resources
- DevDocs – Marquee element
- YouTube – Bouncing DVD Logo 10 hours If you wanted a video to put on in the background