简体   繁体   中英

making animate loop back and forth

i want the tail of the fish ".tail_fin" will rotate back and forth 30 deg

here is the fiddle link: http://jsfiddle.net/3XZ59/9/

/* animate this back and forth in a loop */

 $('.tail_fin').transition({
      rotate: '+=30deg',
      x: '+=10'
    });

Here is what I came up with :

function flipper(){
    $('.tail_fin').transition({
        rotate: '+=30deg',
    }, function(){
        $('.tail_fin').transition({
            rotate: '-=30deg',
        }, flipper());
    });
}

flipper();

Obviously you can mess with it to make it look better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM