jquery - Anyway to start animate smoothly? -


so, instead of using plugin wanted make basic marquee. fair enough. easy enough. works decent. thing bugs me way animate starts little slow , speeds up. there anyway solid speed out of animate function? slow down @ beginning it's no fluid.

var marquee = $('#marquee'),     marqueetext = marquee.find('span:first'),     marqpos = marquee.position(),     marqtextpos = marqueetext.position(),      runmarquee = settimeout(startmarquee, 1000);  function startmarquee() {     marqueetext.css('left', (marqpos.left - marqueetext.width() - 8)).animate({         'left': (marqpos.left + marquee.width() + marqueetext.width() + 8)     }, {         duration: 5000,         complete: function () {             startmarquee();         }     }); } 

update

as adeneo pointed out below, adding easing animate setting linear linear movement remedy problem. not need timeout loop. see updated fiddle.

jsfiddle demo

add linear easing (the default swing)

easing: 'linear' 

fiddle


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -