持续动作
Move
Jump
Scale
Rotate
Skew
Blink
Fade(to,in,out) //FadeIn从透明到不透明
Tint
公用代码:
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCSprite *sp = CCSprite::create("CloseSelected.png");
sp->setPosition(ccp(s.width/2,s.height/2));
addChild(sp);
1、移动
CCActionInterval *moveto = CCMoveTo::create(3.0f,ccp(s.width,s.height)); //参数1:时间、参数2:位置
sp->runAction(moveto);
CCActionInterval *moveby = CCMoveBo::create(3.0f,ccp(s.width,s.height)); //参数1:时间、参数2:位置
sp->runAction(moveto);
注明:moveby跟moveto的区别是moveto是移动到目标位置,moveby是移动距离,也就是横坐标和纵坐标各移动参数的数值
2、跳跃
CCActionInterval *jump =CCJumpTo::create(3.0f,ccp(s.width,s.height),100,5); //参数3:跳跃高度,参数4:跳跃次数
sp->runAction(jump);
3、闪烁
sp->runAction(CCBlink::create(3.0f,5)); 、、参数1:时间,参数2:次数
4、透明度
sp->setOpacity(0);//设置透明
sp->runAction(CCFadeIn::create(3.0f,5)); 、、参数1:时间,参数2:次数
sp->runAciton(CCFadeTo::create(3.0f,100));//设置3秒钟内透明度为100
5、设置颜色
sp->runAction(CCTintTo::create(3.0f,255,255,0));//后面三个参数是RGB