svdotbe
svdotbe

Reputation: 168

Adobe Edge/JQuery: animation doesn't work

For a college assignment I have to develop a product site for Smegg fridges in Adobe Edge Animate. My problem is I want the logo to have a constant opacity transition between full opacity and something like let's say 30%, and then back to 100%, this looping the whole time. I wrote some jQuery code but it doesn't work. Sorry for my bad English it's not my native language. Here is the code:

//Edge symbol: 'stage'
(function(symbolName) {


  Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
     // insert code to be run when the composition is fully loaded here

     var timer = $.timer(logoHandler, 1000);

        function logoHandler() { 
            var state = true;

        if ( state ) {
            $( "#smegLogo" ).animate({
                opacity: 0.3
            }, 500 );
        } else {
            $( "#smegLogo" ).animate({
                opacity: 1
            }, 500 );
        }
        state = !state;

        };

     timer.play();

  });

Upvotes: 1

Views: 1755

Answers (1)

Roko C. Buljan
Roko C. Buljan

Reputation: 206151

Something like this?

http://jsbin.com/abecoz/1/edit

var c=0;
var op = [ '0.3' , '1' ];
function loopLogo(){  
  $("#smegLogo").animate({opacity: op[c++%2]},400, loopLogo); // <- ani. callback
}

loopLogo(); // start loop

Upvotes: 1

Related Questions