0

I'm quite a newbie with annyang. I'm trying to add a Greensock Timeline in a annyang command, but it is not working. I am wondering if it is not possible or if I'm doing something wrong.

This is the code were it is about:

var tlcrocodile = new TimelineLite({paused:true});
if (annyang) { 
  var commands = {
    'hello': function() {
      tlcrocodile.to(".crocodile_1", 0.3 , {x:+40} , 0);
    }
  };

  annyang.addCommands(commands);

  annyang.start();
}

Hopefully someone can help me. Thanks in advance!

Ilse

1 Answers1

1

It seems like your TimelineLite instance never play because you instantiate it as paused but you never call play() on it.

Try instantiating it directly inside the hello command, when you need it to play.
And add a console log to make sure your command was really triggered.

if (annyang) {
    var commands = {
        'hello': function() {
            console.log('Hello command executed.');
            new TimelineLite().to(".crocodile_1", 0.3 , {x:+40} , 0);
        }
    };

    annyang.addCommands(commands);

    annyang.start();
}
sasensi
  • 4,610
  • 10
  • 35