Jump to content
Search Community

rotation acceleration

zlobul test
Moderator Tag

Recommended Posts

I'm new to PIXI and GSAP . I'm building a wheel of fortune game and almost made it . I'm just struggling to fine tune some things like the wheel rotation. I would like the rotation to start smoothly and accelerate then slowly decrease the speed until it stops at the desired position .

 

I have added a codepen which I used as an example to build my code. As you see it starts spinning with maximum speed on click.

 

Any ideas how to made the acceleration on spin start ?

 

Here is the part of my code:


    let rounds = this.getRandomNumber(1, 3)
    const winingSector = this.getRandomNumber(0, 53)
    const rotation = this.piTwo * rounds + this.finalPoisition(winingSector)
    const timeLine = new TimelineMax()   
    timeLine.to(
      this.wheelSprite,
      gameConfig.rotationTime,
      {
        rotation: `+=${rotation}`,
        onComplete: () => {
          this.drawWiningLine(winingSector)
          this.showPrizeText(winingSector)
        }
      }
    )

 

See the Pen oNZBzzz by zlobul (@zlobul) on CodePen

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...