@gmayer wrote:
I am having a problem using a RepeatForever fadein/out action, where the _fromOpacity doesn't seem to get set correctly. Either I'm using it wrong or there is a bug. Here is a bit of code:
m_glows[m_currentStageIndex]->setOpacity(0); // just a sprite auto fadeInAction = FadeIn::create(1.0f); auto fadeOutAction = FadeOut::create(1.0f); auto delayAction = DelayTime::create(1.0f); auto seq = Sequence::create( fadeInAction, fadeOutAction, delayAction, nullptr ); m_glows[m_currentStageIndex]->runAction( RepeatForever::create(seq) );
This runs when an object is activated in the scene. When it's deactivated I stopAllActions. On subsequent activations, the fadein/ou/delay cycle will include a hiccup, that looks like the opacity at the point it was previously deactivated.
If I breakpoint the following 2 methods with condition that (this == fadeInAction (i.e. the hex address))
void FadeTo::startWithTarget(Node *target) { ActionInterval::startWithTarget(target); if (target) { _fromOpacity = target->getOpacity(); } /*_fromOpacity = target->getOpacity();*/ } void FadeTo::update(float time) { if (_target) { _target->setOpacity((GLubyte)(_fromOpacity + (_toOpacity - _fromOpacity) * time)); } /*_target->setOpacity((GLubyte)(_fromOpacity + (_toOpacity - _fromOpacity) * time));*/ }
I only see the update get hit, never the startWithTarget, so even though I forced opacity on the target to 0 at the outset, this doesn't get used to initialize the _fromOpacity.
Any help would be much apprecaited!
Thanks
Greg
Posts: 1
Participants: 1