Nagaraju Posted September 19, 2019 Share Posted September 19, 2019 I am working on image corousal (Image slide). I have two images in two different container under main container. Canvas size is 270* 270. So two containers are set in a position of -270, 0. When user starts slide right animation, I will start ticker and will stop until second container reaches to x coordinate '0'. this.appRenderer.ticker.add(delta => this.tickSlideRight(currentSlideNumber,delta)); // ticker right slide tickSlideRight(currentSlideNumber,delta){ try{ this.imageBaseContainer[currentSlideNumber].x += 1 + delta; if(this.imageBaseContainer[currentSlideNumber].x >= this.appRenderer.screen.width) { console.log(this.imageBaseContainer[currentSlideNumber].x, this.appRenderer.screen.width); this.appRenderer.ticker.stop(); } }catch(ex){ alert(ex.message); //TO-DO } } Can anybody helps me to give duration for ticker within container slide should be happend. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 19, 2019 Share Posted September 19, 2019 when you add something, you can remove it later: let myFunc = (delta) => { ... if (itsTheEnd) { app.ticker.remove(myFunc) } } app.ticker.add(myFunc); In general, animations are called "tweening". Either you need experience on writing animations through callbacks, either you need a library like TweenLite to take care about it. > 1 + delta; That's very strange thing to write. But keep writing all the random stuff, you'll get it one day ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.