cocos2d-x的CCSequence与CCRepeatForever的混用

2018-11-19 16:44:50 浏览数 (1)

想写个简单的动画,让一个按钮,缩大、还原,不停的在那闪烁

代码语言:javascript复制
1:  

       2: CCActionInterval* scaleAction1 = CCScaleTo::create(0.3f, 1.1f, 1.1f);

       3: CCActionInterval* scaleAction2 = CCScaleTo::create(0.3f, 1.0f, 1.0f);

       4:

先放大再还原,然后不停的repeat…

代码语言:javascript复制
1:  

       2: CCActionInterval* seq = (CCActionInterval*)(CCSequence::create(scaleAction1, scaleAction2, NULL));

       3: CCActionInterval* rep = CCRepeatForever::actionWithAction(seq);

       4:

ccsprite->runAction(req);

附一张CCAction类及其子类的结构图:

本文参考:cocos2d-x学习笔记 – CCAction(动作)

0 人点赞