Sign in to follow this  
Nagaraju

Ticker time out in Pixi

Recommended Posts

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. 

Share this post


Link to post
Share on other sites

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 😃

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.