vi posto il codice:
codice:
function createALeaf() {
var leafDiv = document.createElement('div');
var image = document.createElement('img');
image.src = 'images/leaf' + randomInteger(1, 5) + '.png';
leafDiv.style.top = "-100px";
leafDiv.style.left = pixelValue(randomInteger(0, 1024));
var spinAnimationName = (Math.random() < 0.5) ? 'clockwiseSpin' : 'counterclockwiseSpinAndFlip';
leafDiv.style.webkitAnimationName = 'fade, drop';
image.style.webkitAnimationName = spinAnimationName;
var fadeAndDropDuration = durationValue(randomFloat(5, 11));
var spinDuration = durationValue(randomFloat(4, 8));
leafDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + fadeAndDropDuration;
var leafDelay = durationValue(randomFloat(0, 5));
leafDiv.style.webkitAnimationDelay = leafDelay + ', ' + leafDelay;
image.style.webkitAnimationDuration = spinDuration;
leafDiv.appendChild(image);
return leafDiv;
}