Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

animation not working, loop get stuck

i creat animation code for the fish to swim back and forth and he only swim 1 time and stuck can you help pleas?

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

function anim() {
    $('#fish_1').animate({
     "left": "-90px"}, 2000, flip);
}

function back() {
    $('#fish_1').animate({
     "left": "230px"}, 2000, flipBack);
}

anim();

function flip() {
    $('#fish_1').transition({
        perspective: '100px',
        rotateY: '180deg',
        complete: back
    });
}

function flipBack() {
    $('#fish_1').transition({
        perspective: '100px',
        rotateY: '0deg',
        complete: anim
    });
}
like image 992
alonblack Avatar asked Sep 14 '26 19:09

alonblack


1 Answers

You've just forgotten to include the transit library in your fiddle, causing the .transition() method to be undefined:

Example with it included: http://jsfiddle.net/qLCnT/6/

like image 52
412 Avatar answered Sep 16 '26 10:09

412