Class cc.ProgressTimer
- Defined in: CCProgressTimer.js
- Extends cc.NodeRGBA
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.
It renders the inner sprite according to the percentage.
The progress can be Radial, Horizontal or vertical.
Field Detail
draw
stuff gets drawn here
{Boolean}
initWithSprite
Initializes a progress timer with the sprite as the shape the timer goes through
setReverseDirection
Reverse Progress setter
setReverseProgress
setSprite
setType
set Progress type of cc.ProgressTimer
Method Detail
-
create a progress timer object with image file name that renders the inner sprite according to the percentage
// Example var progress = cc.ProgressTimer.create('progress.png')
- Parameters:
- {cc.Sprite} sprite
- Returns:
- {cc.ProgressTimer}
-
{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.Color3B} getColor()return color of sprite
- Returns:
- {cc.Color3B}
-
{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
-
setBarChangeRate(barChangeRate)
- Parameters:
- {cc.Point} barChangeRate
-
setColor(color)set color of sprite
- Parameters:
- {cc.Color3B} color
-
setMidpoint(mpoint)Midpoint setter
- Parameters:
- {cc.Point} mpoint
-
setOpacity(opacity)Opacity
- Parameters:
- {Number} opacity
-
setPercentage(percentage)from 0-100
- Parameters:
- {Number} percentage