..
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user