4 Replies Latest reply on Aug 27, 2014 4:16 PM by JotaSolano

    Conditional "time function" to play timeline

    JotaSolano

      Hello everyone:

       

       

      I'm having trouble doing something I thought would be simpler. I have done this in AS/Flash but it doesn't seem to work in Edge. I have a small animation in the timeline (1s animation of alpha 0 to alpha 100 of group of objets) and I would like it to play specifically at a given time.

       

      I created a funcion called updateClock() that checks the system time and gets hours and minutes and I call this function every second so it updates with setTimeout. I have a conditional to play the animation at a given time (you might need to change this line) that starts at frame 1000, or else, that it freezes the timeline at that very same frame. Finally I call the function.

       

      Right now this code is in .compositionReady, but I also tried a trigger at 1000 ms. Any help with this would be appreciated. At 1000 ms the trigger sym.stop() works. Right now not even that works and the animation plays by itself.

       

       

      function updateClock() {
          var now = new Date(); // current date
                  var m = d.getMinutes();
                  var h = d.getHours();
      
      
          // call this function again in 1000ms
          setTimeout(updateClock, 1000);
         
          if(h== 20 && m== 56) {
      //run the animation
      sym.play(1000); 
        }
        
        else {
        sym.stop(1000);
        }
      }
      
      
      updateClock(); // initial call
      

       

       

      Thank you in advance for any help you can provide.