First, run the quick code:
1 -- [Create a slice progress bar] 2 3 -- create a progress action Action (Progress time, final proportion) 4 Local to1 = ccprogressto: Create (1,100) 5 6 -- pass in the Wizard as the progress bar and create progresstimer 7 Local ptimer = ccprogresstmer: Create (ccsprite: Create (s_ppathsister1) 8 ptimer: settype (kccprogresstimertyperadial) -- set ccprogresstprogretype to radial 9 -- ptimer: setreverseprogress (true) -- set to counter-clockwise rotation load (optional, clockwise by default) 10 ptimer: setposition (ccpointmake (100, S. height/2) 11 ptimer: runaction (ccrepeatforever: Create (to1) 12 layer: addchild (ptimer) 13 14 -- [[progress bar for creating a rectangle] 15 local to2 = ccprogressto: Create (2,100) 16 17 local ptimer1 = ccprogresstimer: Create (ccsprite: Create (s_ppathsister1 )) 18 ptimer1: settype (kccprogresstimertypebar) -- set to rectangular progress bar 19 -- set progress bar 20 ptimer1: setmidpoint (ccpointmake (0, 0) from the left )) 21 -- change the y direction of the progress bar to 0 (the y direction does not change) 22 ptimer1: setbarchangerate (ccpointmake (1, 0) 23 ptimer1: setposition (ccpointmake (100, S. height/2) 24 ptimer1: runaction (ccrepeatforever: Create (to2) 25 layer: addchild (ptimer1)
:
&&
You can also use ccscaleto to load the progress bar. But it is not very good in general.
It's easy to use this ccprogresstimer.
For more information, see quick or cocos2dx ~