更改图层颜色的操作?

Action for changing the color of layer?

我的游戏包含一个场景,即 LayerColor。但是,当我在 "levels" 之间过渡时,我想通过平滑过渡来更改背景颜色。

例如,如果 级别 1 的 rgb 值是 (100,50,70) ,并且 级别 2 的 rgb 值是 (200,30,123).

在几秒钟的时间里,我想慢慢修改图层颜色的rgb值,从1级值到2级值。

是否可以使用 cocos2d 操作来做到这一点?

编辑:

我不想对我图层中的所有子项进行着色。 我的场景是图层颜色类型:

class MyScene : public cocos2d::LayerColor

在 Init 中我设置了颜色:

bool MyScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !LayerColor::initWithColor(Color4B(10, 20, 200, 255) )) {
        return false;
    } ....

我不想对整个场景进行着色。我只想换个颜色。

使用cocos2d::TintTo操作:

auto layer = cocos2d::LayerColor::create(cocos2d::Color4B(100, 50, 70, 255));
...
layer->runAction(cocos2d::TintTo::create(2.0, 200, 30, 123));