1 Reply Latest reply on Oct 30, 2012 3:10 PM by TimJaramillo

    Edit position in keyframe from code




      I have created an animation where I can drop and drag items. On mouseup I have have added a play action that moves the element to a specified position in the document.

      Now the problem is that it moves the element from its original position rather then the current one. Is it possible to access the keyframe and change the elements start location to the current one?

        • 1. Re: Edit position in keyframe from code
          TimJaramillo Level 4

          Hi Anders,


          Since this a dynamic scenario, you would need to move the object through code. I recommend looking into the jQuery animate method. You could do something like this in your mouseup function (assuming it's on Stage/compositionReady event):


          sym.endPosX = 500;// end x position you want object to animate to

          sym.endPosY = 500;// end y position you want object to animate to


          // this will animate your object from it's current position, to the positions specified in the variables above, in .5 seconds, with an ease of "swing"

          sym.$("your_object").animate({left:sym.endPosX, top:sym.endPosY}, 500, 'swing');