Forum Libraries, Components, and Plugins

CCProgressTimer progresses from the center out?

Is this correct behavior? The Bar type CCProgress timer seems to expand from the center and contract to the center based on the percentage. It's like it's still trying to be a radial, rather than a bar. I also don't see a way to change the bar progression from horizontal to vertical.


  • JaredMathesJaredMathes CAUniversity

    I have found the answer to this. It all has to do with the initial setting for some of the parameters of the CCProgressTimer.

    The parameter Midpoint takes a CCPoint. Its default value is a point of (0.5f, 0.5f). By observation, this puts the point that the progress bar grows from or collapses to in the dead center of the bar. Internally, this will be clamped at 0,0 or 1,1 so you can't have a midpoint outside the progress bar. If you have a horizontal bar and you want it to grow from the left, put the midpoint at 0,0, etc.

    The parameter BarChangeRate also takes a point. It uses this point to determine in which directions you want the bar to grow or shrink. By default, this is set to 1,1, meaning that the bar will change in both x and y directions. If you want to restrict the bar along the x axis only, you would make the BarChangeRate (1,0). I assume that since they are float values, you could have the bar change by only a percentage in a given direction by giving it a decimal value.

    Hopefully this helps anyone who is new to this object and doesn't get enough information from the online documentation.

Sign In or Register to comment.