0
只是想知道有没有人知道一种让叶子落在风中的方法?我已经看到它在这里完成:http://www.webkit.org/blog-files/leaves/index.html但这只是WebKit。jQuery动画从头开始下降的叶子
到目前为止我的代码是非常基本的东西动画:
function runParticles() {
$('.theme-bg').prepend('<div class="particles" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; min-height: 100%; background-image: url(images/particle1.png); z-index: 1; background-repeat: no-repeat; background-position: 0px 0px;"></div>');
var randParXa = Math.floor(Math.random() * $('.theme-bg').width());
var randParXb = Math.floor(Math.random() * $('.theme-bg').width());
var randParY = $('.theme-bg').height();
var randParSpd = Math.floor(Math.random() * (2500 - 1550) + 1550);
$('.particles').css({'background-position':randParXa+'px 0px'});
$('.particles').animate({
'background-position':randParXb+'px '+randParY+'px',
'opacity':0.0
}, randParSpd, function() {
$(this).remove();
runParticles();
});
}
runParticles();
帮助将不胜感激。
Urgh,需要更多的信息(我猜,由于投票关闭......?)
所以,我想一个元素<div>
从浏览器和“浮动”的顶部落在从左至右它落下......像一片树叶或一片羽毛。
目前,我的动画只是直线前进。
再次欢呼!
我还要指出的是,背景位置动画提供://www.protofunc.com/scripts/jquery/backgroundPosition/jquery.backgroundPosition.js – 2011-04-08 19:13:19