void DesignLayer::focusChild( cocos2d::CCSprite* pSprite ) { float scaleValue = pSprite->getScale(); CCActionInterval* pAction = CCRepeatForever::create( (CCActionInterval*)CCSequence::create(CCScaleTo::create(0.4f, scaleValue * 1.1f), CCScaleTo::create(0.4f, scaleValue * 0.9f), NULL) ); pSprite->runAction(pAction); pAction->setTag(FocusActionTag); }
// When deactivated, establish an action sequence to first fade the adornment node // back to fully transparent, and then explicitly hide the adornment. Although this // last step is visually redundant, it makes subsequent drawing of the invisible // adornment node more efficient. The action is tagged so that it can be easily found // if it needs to be cancelled. void CCNodeAdornmentOverlayFader::deactivate() { if ( _sprite ) { _sprite->stopActionByTag( kFadeActionTag ); // Cancel any existing fade action CCActionInterval* fadeAction = CCActionFadeOut::create( getActionDuration() ); CCFiniteTimeAction* hideAction = CCActionHide::create(); CCActionInterval* fadeThenHideAction = CCActionSequence::createWithTwoActions( fadeAction, hideAction ); fadeThenHideAction->setTag( kFadeActionTag ); _sprite->runAction( fadeThenHideAction ); } }
void TestFrameEvent::onFrameEvent(cocos2d::extension::CCBone *bone, const char *evt, int originFrameIndex, int currentFrameIndex) { CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt, currentFrameIndex); if (!this->getActionByTag(FRAME_EVENT_ACTION_TAG) || this->getActionByTag(FRAME_EVENT_ACTION_TAG)->isDone()) { this->stopAllActions(); CCActionInterval *action = CCShatteredTiles3D::create(0.2f, CCSizeMake(16,12), 5, false); action->setTag(FRAME_EVENT_ACTION_TAG); this->runAction(action); } }
//------------------------------------------------------------------ // // RemoveTest // //------------------------------------------------------------------ void RemoveTest::onEnter() { ActionManagerTest::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* l = CCLabelTTF::labelWithString("Should not crash", "Thonburi", 16); addChild(l); l->setPosition( CCPointMake(s.width/2, 245) ); CCMoveBy* pMove = CCMoveBy::actionWithDuration(2, CCPointMake(200, 0)); CCCallFunc* pCallback = CCCallFunc::actionWithTarget(this, callfunc_selector(RemoveTest::stopAction)); CCActionInterval* pSequence = (CCActionInterval*) CCSequence::actions(pMove, pCallback, NULL); pSequence->setTag(kTagSequence); CCSprite* pChild = CCSprite::spriteWithFile(s_pPathGrossini); pChild->setPosition(CCPointMake(200, 200)); addChild(pChild, 1, kTagGrossini); pChild->runAction(pSequence); }