How to build a glow lightning effect?

How to build a glow lightning effect?
0.0 0



Is there any way on cocos2d-x to build a glow lightning effect ?

Something like the forum discussed before : .

By searched this forum, I found there is a lightning class porting on cocos2d-x.

It’s good, but it only give a lightning line without glow effect.

Thank you in advanced.


Is this the one?

void addGlowEffect(CCSprite* sprite,

               const ccColor3B& colour, const CCSize& size)


CCPoint pos = ccp(sprite->getContentSize().width / 2, 

    sprite->getContentSize().height / 2);

CCSprite* glowSprite = CCSprite::spriteWithSpriteFrameName("particle-fire.png");




_ccBlendFunc f = {GL_ONE, GL_ONE};


sprite->addChild(glowSprite, -1);

// Run some animation which scales a bit the glow

CCSequence* s1 = CCSequence::actionOneTwo(

                 CCScaleTo::actionWithDuration(0.9f, size.width, size.height),

                 CCScaleTo::actionWithDuration(0.9f, size.width*0.75f, size.height*0.75f));

CCRepeatForever* r = CCRepeatForever::actionWithAction(s1);



Do you mean bloom effect?


How to do bloom effect?


Hi, I’m new user of this forum, so I can’t create new topic.
I have a problem with enableGlow in labelTTF.

auto labelGlow = cocos2d::Label::createWithTTF( "Long Long String Text With Glow", "Fonts/Arial.ttf", 50, cocos2d::Size( 400, 50 ), cocos2d::TextHAlignment::CENTER, cocos2d::TextVAlignment::CENTER );
labelGlow->setTextColor( cocos2d::Color4B::BLUE );
labelGlow->enableGlow( cocos2d::Color4B::RED );
labelGlow->setOverflow( cocos2d::Label::Overflow::SHRINK );
labelGlow->enableWrap( false );
labelGlow->setPosition( cocos2d::Vec2( 250, 400 ) );
addChild( labelGlow );

But glow is not enabled.

Can anyone help me?


TTF glow doesn’t work on some platforms, and even on the ones it works it doesn’t work with some letters. Don’t rely on it too much.