Loading ...
Sorry, an error occurred while loading the content.
 

animation and queuing

Expand Messages
  • Raef Akehurst
    Hi All, I am new to to the YUI and Javascript frameworks in general. I was attracted to the YUI over the others because of the documentation however I was not
    Message 1 of 3 , May 8, 2006
      Hi All,

      I am new to to the YUI and Javascript frameworks in general. I was attracted to the YUI over the others because of the documentation however I was not able to work out a particular issue I am having. I do apologize if this is a stupid question.

      I understand that the animation manager means you can essentually queue animations. I am trying to change a style of an object upon completion of an animation. eg.

      var attributes = { height: {to: 100} }
      var anim = new YAHOO.util.Anim('blah', attributes, 1, YAHOO.util.Easing.easeOut);
      anim.animate();
      YAHOO.util.Dom.setStyle(object, 'visibility', 'visible');

      How is the best way to do this? The code above performs the Dom stuff immediately. I would like to be able to have it perform it after the animation completes.

      Cheers,

      Raef

    • Nige White
      ... What, animate it to the target height while invisible, and THEN make it visible? OK: anim.onComplete.subscribe(function() { YAHOO.util.Dom.setStyle(object,
      Message 2 of 3 , May 8, 2006
        Raef Akehurst wrote:

        > Hi All,
        >
        > I am new to to the YUI and Javascript frameworks in general. I was
        > attracted to the YUI over the others because of the documentation
        > however I was not able to work out a particular issue I am having. I
        > do apologize if this is a stupid question.
        >
        > I understand that the animation manager means you can essentually
        > queue animations. I am trying to change a style of an object upon
        > completion of an animation. eg.
        >
        > var attributes = { height: {to: 100} }
        > var anim = new YAHOO.util.Anim('blah', attributes, 1,
        > YAHOO.util.Easing.easeOut);
        > anim.animate();
        > YAHOO.util.Dom.setStyle(object, 'visibility', 'visible');
        >
        >
        > How is the best way to do this? The code above performs the Dom stuff
        > immediately. I would like to be able to have it perform it after the
        > animation completes.

        What, animate it to the target height while invisible, and THEN make it
        visible?

        OK:

        anim.onComplete.subscribe(function()
        {
        YAHOO.util.Dom.setStyle(object, 'visibility', 'visible');
        };
        anim.animate();

        Nige


        _____________________________________________________________________
        This message has been checked for all known viruses. Virus scanning
        powered by Messagelabs http://www.messagelabs.com For more information
        e-mail : hostmaster@...
      • Nige White
        ... Oops! Missing closing paren on the subscribe() call! _____________________________________________________________________ This message has been checked
        Message 3 of 3 , May 8, 2006
          Nige White wrote:

          >Raef Akehurst wrote:
          >
          >
          >
          >>Hi All,
          >>
          >>I am new to to the YUI and Javascript frameworks in general. I was
          >>attracted to the YUI over the others because of the documentation
          >>however I was not able to work out a particular issue I am having. I
          >>do apologize if this is a stupid question.
          >>
          >>I understand that the animation manager means you can essentually
          >>queue animations. I am trying to change a style of an object upon
          >>completion of an animation. eg.
          >>
          >> var attributes = { height: {to: 100} }
          >> var anim = new YAHOO.util.Anim('blah', attributes, 1,
          >> YAHOO.util.Easing.easeOut);
          >> anim.animate();
          >> YAHOO.util.Dom.setStyle(object, 'visibility', 'visible');
          >>
          >>
          >>How is the best way to do this? The code above performs the Dom stuff
          >>immediately. I would like to be able to have it perform it after the
          >>animation completes.
          >>
          >>
          >
          >What, animate it to the target height while invisible, and THEN make it
          >visible?
          >
          >OK:
          >
          >anim.onComplete.subscribe(function()
          >{
          > YAHOO.util.Dom.setStyle(object, 'visibility', 'visible');
          >};
          >anim.animate();
          >
          >
          Oops! Missing closing paren on the subscribe() call!

          _____________________________________________________________________
          This message has been checked for all known viruses. Virus scanning
          powered by Messagelabs http://www.messagelabs.com For more information
          e-mail : hostmaster@...
        Your message has been successfully submitted and would be delivered to recipients shortly.