FadeTo animation doesn't work. cocos2d

282 views Asked by At

According to this code node must slowly appear, right? It doesn't work. What is wrong?

   CCNodeColor *_backNode = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0 green:0 blue:0    alpha:1.0f]];
    _backNode.opacity=0;
    [self addChild:_backNode z:5];
  [_backNode runAction:[CCActionFadeTo actionWithDuration:2 opacity:0.9]];
1

There are 1 answers

2
CodeSmile On BEST ANSWER

Try it with alpha = 0 and not setting opacity:

CCNodeColor *_backNode = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0 
                                                                    green:0
                                                                     blue:0
                                                                    alpha:0.0f]];