Cocos2d also provides a lot of ways to express images and genie. One of the methods mentioned in the previous article is to switch scenes in a forward or backward direction, which can also be used in images, there is an example in "test" that describes how CCProgressTimer achieves special effects on some images. Such effects can be used as loading animations during loading.
Step 1. Define CCProgressTo. Through the actionWithDuration function, the first parameter is the time is a CCTime object, and the second parameter is the percentage of the result display image. For example, a 100%, a 50%
Step 2 define ccprogresstfile and use progressWithFile. The parameter is the image path.
Step 3 call setType to set the type,
KCCProgressTimerTypeRadialCW clockwise generation
KCCProgressTimerTypeRadialCCW is generated counterclockwise.
KCCProgressTimerTypeHorizontalBarLR is generated from left to right.
KCCProgressTimerTypeHorizontalBarRL is generated from right to left.
KCCProgressTimerTypeVerticalBarBT is generated from bottom to top.
KCCProgressTimerTypeVerticalBarTB generated from top to bottom
Step 4: Set the position. There is nothing to say. Set the position directly.
Step 5: start by using CCRepeatForever (repeated) to pass in the CCProgressTo object
I just started to study this engine. If there are any errors, I hope you can correct them more.
Next, let's take a look at other scenarios in the test class.
CCProgressTimer * progress1 = CCProgressTimer: create (CCSprite: create ("Icon.png "));
Progress1-> setPosition (ccp (100,100 ));
// Set the style of the progress bar
Progress1-> setType (kCCProgressTimerTypeRadial );
// Set the progress value range to [0,100]
Progress1-> setPercentage (100 );
// Reverse progress timing
Progress1-> setReverseProgress (true );
This-> addChild (progress1 );
// The first parameter is the time, and the second parameter is the rotation 100%
CCProgressTo * to1 = CCProgressTo: create (10,100 );
Progress1-> runAction (to1 );
//------------------------------------------
CCProgressTimer * progress2 = CCProgressTimer: create (CCSprite: create ("Icon.png "));
Progress2-> setPosition (ccp (200,100 ));
// Set the style of the progress bar
Progress2-> setType (kCCProgressTimerTypeBar );
// Sets the direction of the timer.
Progress2-> setMidpoint (ccp (0, 1 ));
// Set the start ratio of the timer width and height
Progress2-> setBarChangeRate (ccp (0, 1 ));
This-> addChild (progress2 );
// The first parameter is the time, and the second parameter is the rotation 100%
CCProgressTo * to2 = CCProgressTo: create (10,100 );
Progress2-> runAction (to2 );