Class cc.ProgressTimer

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.Progresstimer is a subclass of cc.Node.

Method Summary

Class Detail

cc.ProgressTimer()
cc.Progresstimer is a subclass of cc.Node.
It renders the inner sprite according to the percentage.
The progress can be Radial, Horizontal or vertical.

Field Detail

{cc.Point} barChangeRate
- This allows the bar type to move the component at a specific rate.
{cc.Point} midPoint

- Midpoint is used to modify the progress start position.
If you're using radials type then the midpoint changes the center point
If you're using bar type the the midpoint changes the bar growth
it expands from the center but clamps to the sprites edge so:
you want a left to right then set the midpoint all the way to cc.p(0,y)
you want a right to left then set the midpoint all the way to cc.p(1,y)
you want a bottom to top then set the midpoint all the way to cc.p(x,0)
you want a top to bottom then set the midpoint all the way to cc.p(x,1)

{Number} percentage
- Percentage to change progress, from 0 to 100.
{Boolean} reverseDir
- Indicate whether the direction is reversed.
{cc.Sprite} sprite
- The sprite to show the progress percentage.
<static> <constant> {Number} cc.ProgressTimer.TEXTURE_COORDS
<static> <constant> {Number} cc.ProgressTimer.TEXTURE_COORDS_COUNT
{enum} type
- Type of the progress timer: cc.ProgressTimer.TYPE_RADIAL|cc.ProgressTimer.TYPE_BAR.
<static> <constant> {Number} cc.ProgressTimer.TYPE_BAR
Bar
<static> <constant> {Number} cc.ProgressTimer.TYPE_RADIAL
Radial Counter-Clockwise

Method Detail

  • <static> {cc.ProgressTimer} cc.ProgressTimer.create(sprite)
    create a progress timer object with image file name that renders the inner sprite according to the percentage
    Parameters:
    {cc.Sprite} sprite
    Deprecated:
    since v3.0,please use new cc.ProgressTimer(sprite) instead.
    Returns:
    {cc.ProgressTimer}
  • ctor(sprite)
    constructor of cc.cc.ProgressTimer
    Parameters:
    {cc.Sprite} sprite
  • {cc.Point} getBarChangeRate()
    This allows the bar type to move the component at a specific rate Set the component to 0 to make sure it stays at 100%. For example you want a left to right bar but not have the height stay 100% Set the rate to be cc.p(0,1); and set the midpoint to = cc.p(0,.5f);
    Returns:
    {cc.Point}
  • {cc.Color} getColor()
    return color of sprite
    Returns:
    {cc.Color}
  • {cc.Point} getMidpoint()
    Midpoint is used to modify the progress start position. If you're using radials type then the midpoint changes the center point If you're using bar type the the midpoint changes the bar growth it expands from the center but clamps to the sprites edge so: you want a left to right then set the midpoint all the way to cc.p(0,y) you want a right to left then set the midpoint all the way to cc.p(1,y) you want a bottom to top then set the midpoint all the way to cc.p(x,0) you want a top to bottom then set the midpoint all the way to cc.p(x,1)
    Returns:
    {cc.Point}
  • {Number} getOpacity()
    return Opacity of sprite
    Returns:
    {Number}
  • {Number} getPercentage()
    Percentages are from 0 to 100
    Returns:
    {Number}
  • {cc.Sprite} getSprite()
    The image to show the progress percentage, retain
    Returns:
    {cc.Sprite}
  • Change the percentage to change progress
    Returns:
    {cc.ProgressTimer.TYPE_RADIAL|cc.ProgressTimer.TYPE_BAR}
  • {Boolean} initWithSprite(sprite)
    Initializes a progress timer with the sprite as the shape the timer goes through
    Parameters:
    {cc.Sprite} sprite
    Returns:
    {Boolean}
  • {boolean} isOpacityModifyRGB()
    only use for jsbinding
    Returns:
    {boolean}
  • {boolean} isReverseDirection()
    return if reverse direction
    Returns:
    {boolean}
  • setBarChangeRate(barChangeRate)
    Parameters:
    {cc.Point} barChangeRate
  • setColor(color)
    set color of sprite
    Parameters:
    {cc.Color} color
  • setMidpoint(mpoint)
    Midpoint setter
    Parameters:
    {cc.Point} mpoint
  • setOpacity(opacity)
    set opacity of sprite
    Parameters:
    {Number} opacity
  • setOpacityModifyRGB(bValue)
    only use for jsbinding
    Parameters:
    bValue
  • setPercentage(percentage)
    from 0-100
    Parameters:
    {Number} percentage
  • setReverseDirection(reverse)
    Reverse Progress setter
    Parameters:
    {Boolean} reverse
  • setReverseProgress(reverse)
    set reverse cc.ProgressTimer
    Parameters:
    {Boolean} reverse
  • setSprite(sprite)
    set sprite for cc.ProgressTimer
    Parameters:
    {cc.Sprite} sprite
  • setType(type)
    set Progress type of cc.ProgressTimer
    Parameters:
    {cc.ProgressTimer.TYPE_RADIAL|cc.ProgressTimer.TYPE_BAR} type