From b519ad0db237eed4e7e8a970f1b5b7101f0c539e Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Sun, 28 Sep 2025 21:37:48 +0200 Subject: [PATCH] .. --- seasonals/autumn.css | 32 ++++++++++++++++++++++++++++---- seasonals/autumn.js | 12 ++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/seasonals/autumn.css b/seasonals/autumn.css index 5bcedda..b1e37ed 100644 --- a/seasonals/autumn.css +++ b/seasonals/autumn.css @@ -48,78 +48,102 @@ @-webkit-keyframes leaf-shake { 0%, 100% { - -webkit-transform: translateX(0) rotate(-15deg); + -webkit-transform: translateX(0) rotate(var(--rotate-start, -20deg)); } 50% { - -webkit-transform: translateX(80px) rotate(15deg); + -webkit-transform: translateX(80px) rotate(var(--rotate-end, 20deg)); } } @keyframes leaf-shake { 0%, 100% { - transform: translateX(0) rotate(-15deg); + transform: translateX(0) rotate(var(--rotate-start, -20deg)); } 50% { - transform: translateX(80px) rotate(15deg); + transform: translateX(80px) rotate(var(--rotate-end, 20deg)); } } .leaf:nth-of-type(0) { left: 0%; animation-delay: 0s, 0s; + --rotate-start: -25deg; + --rotate-end: 22deg; } .leaf:nth-of-type(1) { left: 10%; animation-delay: 1s, 0.5s; + --rotate-start: -32deg; + --rotate-end: 35deg; } .leaf:nth-of-type(2) { left: 20%; animation-delay: 6s, 1s; + --rotate-start: -28deg; + --rotate-end: 28deg; } .leaf:nth-of-type(3) { left: 30%; animation-delay: 4s, 1.5s; + --rotate-start: -38deg; + --rotate-end: 32deg; } .leaf:nth-of-type(4) { left: 40%; animation-delay: 2s, 0.8s; + --rotate-start: -22deg; + --rotate-end: 38deg; } .leaf:nth-of-type(5) { left: 50%; animation-delay: 8s, 2s; + --rotate-start: -35deg; + --rotate-end: 25deg; } .leaf:nth-of-type(6) { left: 60%; animation-delay: 6s, 1.2s; + --rotate-start: -40deg; + --rotate-end: 40deg; } .leaf:nth-of-type(7) { left: 70%; animation-delay: 2.5s, 0.3s; + --rotate-start: -30deg; + --rotate-end: 30deg; } .leaf:nth-of-type(8) { left: 80%; animation-delay: 1s, 1.8s; + --rotate-start: -26deg; + --rotate-end: 36deg; } .leaf:nth-of-type(9) { left: 90%; animation-delay: 3s, 0.7s; + --rotate-start: -34deg; + --rotate-end: 24deg; } .leaf:nth-of-type(10) { left: 25%; animation-delay: 2s, 2.3s; + --rotate-start: -29deg; + --rotate-end: 33deg; } .leaf:nth-of-type(11) { left: 65%; animation-delay: 4s, 1.4s; + --rotate-start: -37deg; + --rotate-end: 27deg; } \ No newline at end of file diff --git a/seasonals/autumn.js b/seasonals/autumn.js index fbdda54..b19433c 100644 --- a/seasonals/autumn.js +++ b/seasonals/autumn.js @@ -100,6 +100,12 @@ function addRandomLeaves(count) { leaveDiv.style.animationDuration = `${randomAnimationDuration}s, ${randomAnimationDuration2}s`; } + // set random rotation angles + const randomRotateStart = -(Math.random() * 40 + 20); // 10deg to 30deg + const randomRotateEnd = Math.random() * 40 + 20; // -10deg to -30deg + leaveDiv.style.setProperty('--rotate-start', `${randomRotateStart}deg`); + leaveDiv.style.setProperty('--rotate-end', `${randomRotateEnd}deg`); + // add the leave to the container autumnContainer.appendChild(leaveDiv); } @@ -130,6 +136,12 @@ function initLeaves() { leafDiv.style.animationDuration = `${randomAnimationDuration}s, ${randomAnimationDuration2}s`; } + // set random rotation angles for standard leaves too + const randomRotateStart = -(Math.random() * 40 + 20); // 10deg to 30deg + const randomRotateEnd = Math.random() * 40 + 20; // -10deg to -30deg + leafDiv.style.setProperty('--rotate-start', `${randomRotateStart}deg`); + leafDiv.style.setProperty('--rotate-end', `${randomRotateEnd}deg`); + leafDiv.appendChild(img); container.appendChild(leafDiv); }