iPhone cocos 2D新手笔记二

设置颜色

1:最简单的,[objSprite setColor:ccc3(r,g,b)];

2:简单的渐变,要使用CCFadeIn

      [objSprite setColor:ccc3(r,g,b)];

      [objSprite setPosition:ccp(w,h)];

      [objSprite setOpacity:0.0f];

      [objSprite runAction:[CCFadeIn actionWithDuration:2.0f]];

3.动态渐变的颜色

  CCGradientLayer *gradientLay = [CCGradientLayer layerWithColor:ccc4(r,g,b,a) toColor:ccc4(r,g,b,a) withDirection:CCGradientDirectionT_B width:480 height:100]

你可能感兴趣的:(iPhone)