Action* RotateBy::copy () { RotateBy* rotateBy = new RotateBy(rotation, duration); if (NULL != interpolator) rotateBy->setInterpolator( interpolator->copy()); return rotateBy; }
RotateBy* RotateBy::create(float fDuration, float fDeltaAngleX, float fDeltaAngleY) { RotateBy *pRotateBy = new RotateBy(); pRotateBy->initWithDuration(fDuration, fDeltaAngleX, fDeltaAngleY); pRotateBy->autorelease(); return pRotateBy; }
RotateBy* RotateBy::create(float rotate_x, float rotate_y, float rotate_z, long _time) { RotateBy* ret = nullptr; gbAlloc(ret); ret->m_dstRotate.x = rotate_x; ret->m_dstRotate.y = rotate_y; ret->m_dstRotate.z = rotate_z; ret->m_remainTimer = _time; ret->autorelease(); return ret; }
//////////////////////////////////////////////////////// // // For test functions // //////////////////////////////////////////////////////// void performanceActions(Sprite* pSprite) { Size size = Director::sharedDirector()->getWinSize(); pSprite->setPosition(ccp((rand() % (int)size.width), (rand() % (int)size.height))); float period = 0.5f + (rand() % 1000) / 500.0f; RotateBy* rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1()); ActionInterval* rot_back = rot->reverse(); Action *permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); pSprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; ActionInterval *grow = ScaleBy::create(growDuration, 0.5f, 0.5f); Action *permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), NULL)); pSprite->runAction(permanentScaleLoop); }
gdx::Action* RotateBy::copy () { RotateBy* rotateBy = RotateBy::build(rotation, duration); if (interpolator != NULL) rotateBy->setInterpolator(interpolator->copy()); return rotateBy; }