Share Posted March 3, 2017 Hey guys, var panWidth = $(".panContain").width(); var panImg = $(".panContain").find(".panImg"); var start = 50; var width = panImg.width() - panWidth; var tl = new TimelineMax({ onComplete: function onComplete() { start = 0; tl.reverse(); }, onReverseComplete: function onReverseComplete() { start = 0; tl.restart(); } }); tl.fromTo(panImg, 20, { "transform": "translate("+ -start +"px,0)", }, { "transform": "translate(-" + width + "px,0)", ease: Linear.easeNone }); Please Help, Here i want to set from value to "transform": "translate("+ -start +"px,0)" only when start. onComplete i want to tl.reverse() to "transform": "translate(0,0)" not 50 then again restart it from "transform": "translate(0,0)" not 50. Above my code does not reset start to 0 onComplete. See the Pen jBqpxe by vishalbhulku (@vishalbhulku) on CodePen Link to comment Share on other sites More sharing options...
Share Posted March 3, 2017 Animation values aren't dynamic. To do this, just create a starting animation, and loop the rest... See the Pen xqVaJX?editors=0010 by osublake (@osublake) on CodePen 3 Link to comment Share on other sites More sharing options...
Author Share Posted March 5, 2017 Thanks a lot.... u r champ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now