Fill a bar smoothly

  • i want in my game to have a bar that fills smootlhy.

    it should start fast and then slow down when is nearest to fill.

    right now im filling the bar with every 0.01 sec, but its allways the same speed..

    i heard somewhere that lerp function could do the trick but im not sure how to use it.

    if anyone can give me some help..

    thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is an example of a lerping bar,

    Lerp has 3 parameters :

    • the minimal value
    • the maximal value
    • the step to take

    If the step is 0, lerp will be the minimal, 1 will be the maximal.

    By using "set Something to lerp(Something, GoalValue, Speed)", with :

    • Something being your width in this example
    • Goalvalue being the maximal width of the bar here
    • Speed being tested with different values, you have 2 settings in the example.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)