Cocos2dx <基础> 特殊的动作

<EaseSine系列>----> 对象做变速运动


a.  EaseSineIn ----> 物体先慢后快 

b.  EaseSineOut---> 物体先快后慢

c.  EaseSineInOut-> 物体执行Sine运动

	auto spriteFrame = SpriteFrame::create("mp.png", Rect(0, 81.25 * 2, 81.25, 81.25));
	auto sprite1 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite1->setPosition(Vec2(100, 500));
	this->addChild(sprite1);
	auto sprite2 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite2->setPosition(Vec2(100, 300));
	this->addChild(sprite2);
	//执行特殊的动作
	auto move = MoveBy::create(4,Vec2(650,0));
	sprite1->runAction(move);

	auto easeIn = EaseSineOut::create((MoveBy*)move->clone());
	sprite2->runAction(easeIn);


<EaseBounce系列>-----> 弹跳运动

a. EaseBounceIn----->开始的时候弹跳几下,然后进入

b. EaseBounceOut----->开始的时候进入,结束的时候弹跳几下

c. EaseBounceInOut--->开始的时候弹跳几下,然后进入,结束的时候再弹跳几下

扫描二维码关注公众号,回复: 148463 查看本文章
	auto spriteFrame = SpriteFrame::create("mp.png", Rect(0, 81.25 * 2, 81.25, 81.25));
	auto sprite1 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite1->setPosition(Vec2(100, 500));
	this->addChild(sprite1);
	auto sprite2 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite2->setPosition(Vec2(100, 300));
	this->addChild(sprite2);
	//执行特殊的动作
	auto move = MoveBy::create(4,Vec2(650,0));
	sprite1->runAction(move);

	auto easeIn = EaseBounceIn::create((MoveBy*)move->clone());
	sprite2->runAction(easeIn);


<EaseExponential系列>------> 指数运动,变化大

a. EaseExponentialIn----> 刚开始慢,后面非常快

b. EaseExponentialOut----> 刚开始非常快,后面慢

c. EaseExponentialInOut----> 刚开始慢,然后非常快,最后慢

	auto spriteFrame = SpriteFrame::create("mp.png", Rect(0, 81.25 * 2, 81.25, 81.25));
	auto sprite1 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite1->setPosition(Vec2(100, 500));
	this->addChild(sprite1);
	auto sprite2 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite2->setPosition(Vec2(100, 300));
	this->addChild(sprite2);
	//执行特殊的动作
	auto move = MoveBy::create(4,Vec2(650,0));
	sprite1->runAction(move);

	auto easeIn = EaseExponentialInOut::create((MoveBy*)move->clone());
	sprite2->runAction(easeIn);


<EaseElastic系列>----->橡皮筋效果

a. EaseElasticIn----->刚开始拉伸,然后运动

b. EaseElasticOut----->刚开始运动,后面拉伸

c. EaseElasticInOut---->刚开始拉伸,然后运动,最后拉伸

	auto spriteFrame = SpriteFrame::create("mp.png", Rect(0, 81.25 * 2, 81.25, 81.25));
	auto sprite1 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite1->setPosition(Vec2(100, 500));
	this->addChild(sprite1);
	auto sprite2 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite2->setPosition(Vec2(100, 300));
	this->addChild(sprite2);
	//执行特殊的动作
	auto move = MoveBy::create(4,Vec2(650,0));
	sprite1->runAction(move);

	auto easeIn =EaseElasticOut::create((MoveBy*)move->clone());
	sprite2->runAction(easeIn);


<EaseBack系列>----->稍微弹跳

a. EaseBackIn---->刚开始稍微弹跳,然后运动

b. EaseBackOut---->刚开始运动,然后稍微弹跳

c. EaseBackInOut-->刚开始稍微弹跳,然后运动,最后再稍微弹跳

	auto spriteFrame = SpriteFrame::create("mp.png", Rect(0, 81.25 * 2, 81.25, 81.25));
	auto sprite1 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite1->setPosition(Vec2(100, 500));
	this->addChild(sprite1);
	auto sprite2 = Sprite::createWithSpriteFrame(spriteFrame);
	sprite2->setPosition(Vec2(100, 300));
	this->addChild(sprite2);
	//执行特殊的动作
	auto move = MoveBy::create(4,Vec2(650,0));
	sprite1->runAction(move);

	auto easeIn = EaseBackOut::create((MoveBy*)move->clone());
	sprite2->runAction(easeIn);


猜你喜欢

转载自blog.csdn.net/wue1206/article/details/80187255
今日推荐