This commit is contained in:
CodeDevMLH
2025-09-28 21:37:48 +02:00
parent b3a531e3a9
commit b519ad0db2
2 changed files with 40 additions and 4 deletions

View File

@@ -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);
}