Jquery动画在曲线上倾斜

时间:2014-04-17 14:29:32

标签: jquery

我想在https://dl.dropboxusercontent.com/u/246684898/VipSitaraman.com/examples/index.htm更改我的网站演示,为飞机制作动画,使其实际上以一种类似罪恶的动作来回倾斜。怎么样?

当前代码:

<script type='text/javascript'>//<![CDATA[ 

$(function (){
    var sdegree = 0;
    var orig = 0;
    var z = 1 + Math.random() * 20
    $(window).scroll(function () {
        if (sdegree > -15 && sdegree < 15 && sdegree - orig >= 0) {
            orig = sdegree;
            sdegree = sdegree + 1;
        } else if (sdegree > -15 && sdegree < 15 && sdegree - orig < 0) {
            orig = sdegree;
            sdegree = sdegree - 1;
        } else if (sdegree <= -15) {
            orig = sdegree;
            sdegree = sdegree + 1;
        } else if (sdegree >= 15) {
            orig = sdegree;
            sdegree = sdegree - 1;
        } else {
            orig = sdegree;
        }
        var srotate = "rotate(" + sdegree + "deg)";
        $('.plane').css('z-index','z');
        $(".plane").css({
            transform: srotate
        });
    });
});
//]]>  

</script>

0 个答案:

没有答案