Created
April 28, 2025 22:52
-
-
Save alirezarezamand/ebd32c5a9a999fd4410bdc3aaa28955f to your computer and use it in GitHub Desktop.
Untitled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<main> | |
<section> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
</section> | |
</main> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const logos = document.querySelectorAll('div') | |
for (let i = 0; i < logos.length; i++) { | |
logos[i].style.setProperty('--i', i) | |
logos[i].style.setProperty('--d', Math.random() * 8) | |
logos[i].style.setProperty('--a', Math.random() * 8 + 4) | |
logos[i].style.setProperty('--hue', Math.floor(Math.random() * 360)) | |
logos[i].style.setProperty('--y', Math.floor(Math.random() * 100)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
min-height: 100vh; | |
display: grid; | |
place-items: center; | |
} | |
main { | |
transform-style: preserve-3d; | |
perspective: 80vmin; | |
} | |
section { | |
width: 100vmin; | |
aspect-ratio: 4 / 3; | |
outline: 2px dashed red; | |
transform-origin: 100% 50%; | |
rotate: y 40deg; | |
container-type: inline-size; | |
mask: linear-gradient(90deg, #0000 0 40px, #fff, #0000 calc(100% - 40px) 100%); | |
div { | |
width: 40px; | |
aspect-ratio: 1; | |
background: red; | |
position: absolute; | |
top: calc(var(--y) * 1%); | |
background: hsl(var(--hue) 90% 60%); | |
animation-name: travel; | |
animation-iteration-count: infinite; | |
animation-delay: calc(var(--d) * -1s); | |
animation-duration: calc(var(--a) * 1s); | |
} | |
} | |
@keyframes travel { | |
0% { | |
translate: 100cqi 0; | |
} | |
100% { | |
translate: -50% 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment