move.js icon indicating copy to clipboard operation
move.js copied to clipboard

Remove animation properties after animation is completed

Open carlmathisen opened this issue 10 years ago • 4 comments

Hi!

Thank you for a great library.

I was wondering, if I first animate a box like this:

move('#square').to(300, 200).end();

And then I want to position the box without an animation, like in this pure JS example:

document.getElementById('square').style.transform = "translate(200px, 200px)";

It will animate with move.js's settings, because

transition-duration: 500ms;

is not removed from element styles when the animation is completed. By design?

I think those styles should be removed when end() is triggered.

Carl

carlmathisen avatar Jan 29 '15 09:01 carlmathisen

The question is, how does one know which ones to keep and which ones to discard? By using .to() to position the element, I still want to keep the translate property while removing everything else. There probably are similar "end state" issues with every animation.

carlmathisen avatar Jan 29 '15 09:01 carlmathisen

Could you not just remove that style manually from the ones you want?

jamesaspence avatar Nov 15 '15 02:11 jamesaspence

I just use jquery to solve the problem. http://api.jquery.com/animate/

jlma7 avatar Nov 16 '15 04:11 jlma7

@jamesaspence Sure, but it should be handled my move.js.

@jlma7 So if I use jQuery.animate, what's the point of using move.js then? :-)

carlmathisen avatar Nov 16 '15 09:11 carlmathisen