1.不多说,重力加速度。
2.ActionMangerTest:此Test是为了展示通过导演类来获得动作管理器ActionManager类。来控制节点动作。
①CrashTest:销毁demo,在精灵运行旋转的同一时候运行让精灵延时消失和该层延迟自我销毁,此系列动作同一时候运行。
②LogicTest:先让grossini横向移动150像素,然后让其X,Y一同缩放2倍。
③PauseTest 通过动作管理器实现动作延迟。知识点:
auto director = Director::getInstance();
director->getActionManager()->addAction(action, grossini, true);//将action加入到grossini,
第三个參数true代表暂停此动作。
schedule( schedule_selector(PauseTest::unpause), 3); 3为间隔,单位为秒。
3秒后回调函数。
可是确实是5秒。求大神解答。
④StopActionTest:运行一个动作后停止(Sprite*)->stopActionByTag(kTagSequence);
⑤ResumeTest:暂停3秒后。grossini运行旋转360°的同一时候放大2倍。
auto director = Director::getInstance();
director->getActionManager()->pauseTarget(pGrossini);//pauseTarget(Node*)停止当前节点一切动作
director->getActionManager()->resumeTarget(pGrossini);//resumeTarget(Node*)恢复节点全部动作。
两个方法成对出现。
3.Actions-Basic:此demo中体现ccp由Point取代
①ActionManual:直接设置精灵的属性demo。
const Color3B Color3B::RED (255, 0, 0);
const Color3B Color3B::GREEN ( 0, 255, 0);
const Color3B Color3B::BLUE ( 0, 0, 255);
//第四个參数为透明度。前三个同上
const Color4B Color4B::RED (255, 0, 0, 255);
const Color4B Color4B::GREEN ( 0, 255, 0, 255);
const Color4B Color4B::BLUE ( 0, 0, 255, 255);
//參数同上,就是用比例方式传參
const Color4F Color4F::WHITE ( 1, 1, 1, 1);
const Color4F Color4F::YELLOW ( 1, 1, 0, 1);
const Color4F Color4F::GREEN ( 0, 1, 0, 1);
const Color4F Color4F::BLUE ( 0, 0, 1, 1);
const Color4F Color4F::RED ( 1, 0, 0, 1);
const Color4F Color4F::MAGENTA( 1, 0, 1, 1);
const Color4F Color4F::BLACK ( 0, 0, 0, 1);
const Color4F Color4F::ORANGE ( 1, 0.5f, 0, 1);
const Color4F Color4F::GRAY (0.65f, 0.65f, 0.65f, 1);
//以下的求解释
const BlendFunc BlendFunc::DISABLE = {GL_ONE, GL_ZERO};
const BlendFunc BlendFunc::ALPHA_PREMULTIPLIED = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
const BlendFunc BlendFunc::ALPHA_NON_PREMULTIPLIED = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
const BlendFunc BlendFunc::ADDITIVE = {GL_SRC_ALPHA, GL_ONE};
②ActionMove:MoveTo/MoveBy。使用方法:此动作是移动。
auto actionTo = MoveTo::create(2, Point(s.width-40, s.height-40));
auto actionBy = MoveBy::create(2, Point(80,80));
auto actionByBack = actionBy->reverse();
③ActionRotate:RotateBy/RotateTo。使用方法:此动作是旋转。
auto actionTo = RotateTo::create( 2, 45);
auto actionBy = RotateBy::create(2 , 360);
auto actionByBack = actionBy->reverse();
④ActionRotateBy3D:RotateBy。在3D世界旋转。
X,Y坐标的基点是左下角。Z坐标的基点就是中心?
从源代码看出,仅仅有RotateBy有。使用方法:
auto actionBy1 = RotateBy::create(4, Vertex3F(360, 0, 0));
auto actionBy2 = RotateBy::create(4, Vertex3F(0, 360, 0));
auto actionBy3 = RotateBy::create(4 ,Vertex3F(0, 0, 360));
⑤ActionScale:ScaleTo/ScaleBy。此动作是设置缩放,參数大于零放大,小于一是缩小,负数为翻转。
使用方法:
auto actionTo = ScaleTo::create(2.0f, 0.5f);
auto actionBy = ScaleBy::create(2.0f, 1.0f, 10.0f);
auto actionBy2 = ScaleBy::create(2.0f, 5.0f, 1.0f);
⑥ActionSkew:SkewTo/SkewBy。此动作是设置倾斜。使用方法:(此动作不懂)
auto actionTo = SkewTo::create(2, 37.2f, -37.2f);
auto actionToBack = SkewTo::create(2, 0, 0);
auto actionBy = SkewBy::create(2, 0.0f, -90.0f);
auto actionBy2 = SkewBy::create(2, 45.0f, 45.0f);
⑦ActionRotationalSkew:相同是RotateBy/RotateTo。
仅仅只是是两个參数,各自是X和Y。用单独的旋转角度。
使用方法:
auto actionByBack = actionBy->reverse();
auto actionTo = RotateTo::create(2, 180, 180);
auto actionToBack = RotateTo::create(2, 0, 0);
auto actionBy = RotateBy::create(2, 0.0f, 360);
auto actionByBack = actionBy->reverse();
auto actionBy2 = RotateBy::create(2, 360, 0);
auto actionBy2Back = actionBy2->reverse();
⑧ActionRotationalSkewVSStandardSkew:标准Skew和Rotate比較,据发现Skew会牵扯到缩放系数。
使用方法同上。
⑨ActionSkewRotateScale:三个动作同一时候运行。
SizeMake改为Size。
使用方法:
box->runAction(Sequence::create(actionTo, actionToBack, NULL));
box->runAction(Sequence::create(rotateTo, rotateToBack, NULL));
box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL));
⑩ActionJump:JumpTo/JumpBy。不用解释。
基本动作完毕,综上总结Skew和Rotate都为差别为。Skew改变了节点的缩放系数,详细改变求解说。